-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.9.6: pytest is failing in few units #182
Comments
Some extra packages are needed for testing, and some of the tests are not meant to be run normally (we're testing a testing tool, so naturally it has some sample failing tests around). The testing procedure used in this repo is defined in the Lines 22 to 33 in 6dd2eaa
|
Line 25 in 6dd2eaa
Instead passing `tests/' it should be part of the pytest.ini testpaths variable. As well if you want to use coveryty test please move that from pytest.ini to CI. |
Updated pytest output of 0.10.0 + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nbval-0.10.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nbval-0.10.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.17, pytest-7.4.0, pluggy-1.2.0
rootdir: /home/tkloczko/rpmbuild/BUILD/nbval-0.10.0
plugins: nbval-0.10.0, anyio-3.7.0, mock-3.11.1
collected 17 items
issues/67/test_1.py . [ 5%]
issues/67/test_2.py FF [ 17%]
issues/7/test_lib.py . [ 23%]
tests/test_collect.py .. [ 35%]
tests/test_coverage.py F [ 41%]
tests/test_ignore.py . [ 47%]
tests/test_nbdime_reporter.py . [ 52%]
tests/test_plugin.py . [ 58%]
tests/test_timeouts.py . [ 64%]
tests/test_unit_tests_in_notebooks.py ...... [100%]
=================================== FAILURES ===================================
____________________________________ test_b ____________________________________
def test_b():
> raise AssertionError
E AssertionError
issues/67/test_2.py:2: AssertionError
____________________________________ test_c ____________________________________
def test_c():
> assert 1 == 2
E assert 1 == 2
issues/67/test_2.py:5: AssertionError
________________________________ test_coverage _________________________________
testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-163/test_coverage0')>
def test_coverage(testdir):
testdir.makepyfile(
# Setup file to cover:
lib="""
def mysum(a, b):
return a + b
def myprod(a, b):
return a * b
""",
# Setup python file to cover mysum function
test_lib="""
import lib
def test_sum():
assert lib.mysum(1, 3) == 4
assert lib.mysum("cat", "dog") == "catdog"
assert lib.mysum(1.5, 2) == 3.5
""",
)
# Setup notebook to cover myprod function
nb = build_nb([
"import lib",
"lib.myprod(1, 3)",
"lib.myprod(2.5, 2.5)",
"lib.myprod(2, 'cat')"
], mark_run=True)
add_expected_plaintext_outputs(nb, [
None, "3", "6.25", "'catcat'"
])
# Write notebook to test dir
nbformat.write(nb, os.path.join(
str(testdir.tmpdir), 'test_coverage.ipynb'))
# Run tests
result = testdir.runpytest_inprocess('--nbval', '--nbval-current-env', '--cov', '.')
# Check tests went off as they should:
> assert result.ret == 0
E assert <ExitCode.USAGE_ERROR: 4> == 0
E + where <ExitCode.USAGE_ERROR: 4> = <RunResult ret=ExitCode.USAGE_ERROR len(stdout.lines)=0 len(stderr.lines)=5 duration=0.04s>.ret
/home/tkloczko/rpmbuild/BUILD/nbval-0.10.0/tests/test_coverage.py:52: AssertionError
----------------------------- Captured stderr call -----------------------------
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --cov
inifile: None
rootdir: /tmp/pytest-of-tkloczko/pytest-163/test_coverage0
=========================== short test summary info ============================
FAILED issues/67/test_2.py::test_b - AssertionError
FAILED issues/67/test_2.py::test_c - assert 1 == 2
FAILED tests/test_coverage.py::test_coverage - assert <ExitCode.USAGE_ERROR: ...
======================== 3 failed, 14 passed in 37.11s ========================= |
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulesHere is pytest output:
Here is list of modules isntalled in build env:
The text was updated successfully, but these errors were encountered: