Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ name: Check PR
branches:
- main

permissions: {}
permissions:
contents: read

jobs:
unittest:
Expand All @@ -33,6 +34,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
Expand Down Expand Up @@ -78,6 +81,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
Expand Down
1 change: 1 addition & 0 deletions tests/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def yesAnalytics():
def notInvoked() -> None:
assert(False)

@unittest.skip("Analytics are currently disabled")
class TestAnalytics(unittest.TestCase):
def test_analytics(self) -> None:
self.assertEqual(False, decideAnalytics(hasDisableFile=False,
Expand Down
4 changes: 3 additions & 1 deletion tests/test_packagelist.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from textwrap import dedent
import os
import unittest
from unittest import mock
from unittest.mock import patch
import tempfile

from bits_helpers.cmd import getstatusoutput
Expand Down Expand Up @@ -79,7 +81,7 @@
}

class MockReader:
def __init__(self, url, dist=None):
def __init__(self, url, dist=None, genPackages=None):
self._contents = RECIPES[url]
self.url = "mock://" + url

Expand Down
5 changes: 3 additions & 2 deletions tests/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
# Assuming you are using the mock library to ... mock things
from unittest.mock import patch

from bits_helpers.utilities import doDetectArch, filterByArchitectureDefaults, disabledByArchitectureDefaults, getPkgDirs
from bits_helpers.utilities import doDetectArch, filterByArchitectureDefaults, disabledByArchitectureDefaults
from bits_helpers.utilities import Hasher
from bits_helpers.utilities import asList
from bits_helpers.utilities import prunePaths
from bits_helpers.utilities import resolve_version
from bits_helpers.utilities import topological_sort
from bits_helpers.utilities import resolveFilename, resolveDefaultsFilename
import bits_helpers
import bits_helpers.log
import os
import string

Expand Down Expand Up @@ -282,7 +283,7 @@ def test_cycle(self) -> None:
"C": {"package": "C", "requires": ["D"]},
"D": {"package": "D", "requires": ["A"]}
}
with patch.object(alibuild_helpers.log, 'error') as mock_error:
with patch.object(bits_helpers.log, 'error') as mock_error:
with self.assertRaises(SystemExit) as cm:
list(topological_sort(specs))
self.assertEqual(cm.exception.code, 1)
Expand Down
24 changes: 12 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ changedir = {envtmpdir}
commands =
# The first coverage command shouldn't have an -a, so we completely replace
# the coverage info from the last run.
coverage run --source={toxinidir} {toxinidir}/bitsBuild analytics off
test -e .config/bits/disable-analytics
test ! -e .config/bits/analytics-uuid
coverage run --source={toxinidir} -a {toxinidir}/bitsBuild analytics on
test ! -e .config/bits/disable-analytics
test -e .config/bits/analytics-uuid
coverage run --source={toxinidir} -a {toxinidir}/bitsBuild analytics off
test -e .config/bits/disable-analytics
test -e .config/bits/analytics-uuid
# coverage run --source={toxinidir} {toxinidir}/bitsBuild analytics off
# test -e .config/bits/disable-analytics
# test ! -e .config/bits/analytics-uuid
# coverage run --source={toxinidir} -a {toxinidir}/bitsBuild analytics on
# test ! -e .config/bits/disable-analytics
# test -e .config/bits/analytics-uuid
# coverage run --source={toxinidir} -a {toxinidir}/bitsBuild analytics off
# test -e .config/bits/disable-analytics
# test -e .config/bits/analytics-uuid

coverage run --source={toxinidir} -a {toxinidir}/bitsBuild version

Expand All @@ -90,12 +90,12 @@ commands =
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build broken6 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "while scanning a quoted scalar"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build broken7 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Malformed entry prefer_system"'
# This should check that we build different packages depending on the track_env
sh -c 'TRACKED_ENV=foo coverage run --source={toxinidir} -a {toxinidir}/aliBuild -c {toxinidir}/tests/testdist build tracking-env --force-unknown-architecture --no-system --disable GCC-Toolchain --debug 2>&1 | tee /dev/stderr | grep "Building with foo"'
sh -c 'TRACKED_ENV=bar coverage run --source={toxinidir} -a {toxinidir}/aliBuild -c {toxinidir}/tests/testdist build tracking-env --force-unknown-architecture --no-system --disable GCC-Toolchain --debug 2>&1 | tee /dev/stderr | grep "Building with bar"'
sh -c 'TRACKED_ENV=foo coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build tracking-env --force-unknown-architecture --no-system --disable GCC-Toolchain --debug 2>&1 | tee /dev/stderr | grep "Building with foo"'
sh -c 'TRACKED_ENV=bar coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build tracking-env --force-unknown-architecture --no-system --disable GCC-Toolchain --debug 2>&1 | tee /dev/stderr | grep "Building with bar"'
# Fake the development package
rm -fr tracking-env
git clone -b alibuild_CI --depth 1 https://github.com/alisw/alidist tracking-env
sh -c 'TRACKED_ENV=bar coverage run --source={toxinidir} -a {toxinidir}/aliBuild -c {toxinidir}/tests/testdist build tracking-env --force-unknown-architecture --no-system --disable GCC-Toolchain --debug 2>&1 | tee /dev/stderr | grep "Building with bar"'
sh -c 'TRACKED_ENV=bar coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build tracking-env --force-unknown-architecture --no-system --disable GCC-Toolchain --debug 2>&1 | tee /dev/stderr | grep "Building with bar"'

# Make sure that etc/profile.d/init.sh is re-written properly, even if the package build overwrites it.
# In particular, AliEn-Runtime does this, so we must handle this.
Expand Down
Loading