Skip to content

Commit

Permalink
squash: more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
happz committed Feb 16, 2024
1 parent d4380aa commit b3ec95b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
9 changes: 9 additions & 0 deletions tests/unit/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ environment:

ENABLE_PARALLELIZATION: "no"
ENABLE_CONTAINERS: "no"
WITH_SYSTEM_PACKAGES: "no"

require+:
- gcc
Expand All @@ -31,3 +32,11 @@ require+:
environment+:
ENABLE_PARALLELIZATION: "yes"
ENABLE_CONTAINERS: "yes"

adjust+:
- when: initiator == packit
environment+:
WITH_SYSTEM_PACKAGES: "yes"

require+:
- python3-pytest
17 changes: 15 additions & 2 deletions tests/unit/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,27 @@ rlJournalStart
rlLogInfo "PYTEST_MARK=$PYTEST_MARK"

rlRun "PYTEST_COMMAND='pytest -vvv -ra --showlocals'"

# rlRun "hatch -v env create test"
rlPhaseEnd

rlPhaseStartTest "Unit tests"
rlRun "hatch -v run $HATCH_ENVIRONMENT:$PYTEST_COMMAND $PYTEST_PARALLELIZE $PYTEST_MARK tests/unit"
rlPhaseEnd

if [ "$WITH_SYSTEM_PACKAGES" = "yes" ]; then
rlPhaseStartTest "Unit tests against system Python packages"
rlRun "TEST_VENV=$(mktemp -d)"

rlRun "python3 -m venv $TEST_VENV --system-site-packages"
rlRun "ln -s /usr/bin/pytest $TEST_VENV/bin/"
rlRun "$TEST_VENV/bin/pip install pytest-container pytest-xdist"

# Note: we're not in the root directory!
rlRun "$TEST_VENV/bin/$PYTEST_COMMAND $PYTEST_PARALLELIZE $PYTEST_MARK ."

rlRun "rm -rf $TEST_VENV"
rlPhaseEnd
fi

rlPhaseStartCleanup
rlPhaseEnd
rlJournalEnd

0 comments on commit b3ec95b

Please sign in to comment.