Skip to content

Commit

Permalink
- fixed tests causing issues in 'sortedcontainers' package;
Browse files Browse the repository at this point in the history
- fixed test workflow commands;
  • Loading branch information
jaltmayerpizzorno committed Feb 1, 2024
1 parent b008b13 commit 8261672
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
- name: install dependencies
run: |
python3 -m pip install pytest hypothesis
python3 -m pip install -e .
python3 -m pip install .
- name: run tests
run: python3 -m pytest
run: |
python3 -m pytest
10 changes: 5 additions & 5 deletions tests/test_testrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def make_failing_suite(tests_dir: Path, fail_collect: bool):
seq2p(tests_dir, seq).write_text('def test_foo(): pass')

culprit = seq2p(tests_dir, 3)
culprit.write_text("import sys\n" + "sys.hexversion=0")
culprit.write_text("import sys\n" + "sys.foobar = True")

failing = seq2p(tests_dir, 6)
if fail_collect:
failing.write_text("import sys\n" + "assert sys.hexversion != 0\n" + "def test_foo(): pass")
failing.write_text("import sys\n" + "assert not getattr(sys, 'foobar', False)\n" + "def test_foo(): pass")
else:
failing.write_text("import sys\n" + "def test_foo(): assert sys.hexversion != 0")
failing.write_text("import sys\n" + "def test_foo(): assert not getattr(sys, 'foobar', False)")

return failing, culprit

Expand Down Expand Up @@ -100,10 +100,10 @@ def test_find_culprit_multiple_failures(tmpdir):
tests_dir = Path(tmpdir)

for seq in range(10):
seq2p(tests_dir, seq).write_text("import sys\n" + "def test_foo(): assert sys.hexversion != 0")
seq2p(tests_dir, seq).write_text("import sys\n" + "def test_foo(): assert not getattr(sys, 'foobar', False)")

culprit = seq2p(tests_dir, 3)
culprit.write_text("import sys\n" + "sys.hexversion=0")
culprit.write_text("import sys\n" + "def test_foo(): sys.foobar = True")

with pytest.raises(tr.EarlierFailureException):
btf = tr.BadTestsFinder(tests_dir=tests_dir, trace=print)
Expand Down

0 comments on commit 8261672

Please sign in to comment.