Skip to content
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

test/conftest.py references nonexistant file #202

Open
Apteryks opened this issue Dec 2, 2024 · 1 comment
Open

test/conftest.py references nonexistant file #202

Apteryks opened this issue Dec 2, 2024 · 1 comment

Comments

@Apteryks
Copy link

Apteryks commented Dec 2, 2024

Hi,

TEST_DATA_DIR = os.path.join(curdir, 'libbrotli', 'tests', 'testdata')

TEST_DATA_DIR references a $PWD/libbrotli/tests/testdata directory, which doesn't exist, which breaks pytest execution like:

ImportError while loading conftest '/tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/conftest.py'.
test/conftest.py:11: in <module>
    os.path.join(TEST_DATA_DIR, p) for p in os.listdir(TEST_DATA_DIR)
E   FileNotFoundError: [Errno 2] No such file or directory: '/tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/libbrotli/tests/testdata'
@Apteryks Apteryks changed the title test/conftest.py referenced nonexistant file test/conftest.py references nonexistant file Dec 2, 2024
@Apteryks
Copy link
Author

Apteryks commented Dec 2, 2024

Passing --noconftest to pytest in turns breaks all the tests using the compressed file fixture, e.g.:

==================================== ERRORS ====================================
___________ ERROR at setup of test_roundtrip_compression_with_files ____________
file /tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_compression.py, line 16
  def test_roundtrip_compression_with_files(simple_compressed_file):
E       fixture 'simple_compressed_file' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_compression.py:16
_________________ ERROR at setup of test_streaming_compression _________________
file /tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_compression.py, line 28
  @pytest.mark.slow
  @settings(deadline=None)
  @given(
      chunk_size=integers(min_value=1, max_value=2**12),
      mode=sampled_from(list(brotlicffi.BrotliEncoderMode)),
      quality=integers(min_value=0, max_value=11),
      lgwin=integers(min_value=10, max_value=24),
      lgblock=one_of(
          integers(min_value=0, max_value=0),
          integers(min_value=16, max_value=24)
      ),
  )
  def test_streaming_compression(one_compressed_file,
E       fixture 'one_compressed_file' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_compression.py:28
______________ ERROR at setup of test_streaming_compression_flush ______________
file /tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_compression.py, line 67
  @pytest.mark.slow
  @settings(deadline=None)
  @given(
      chunk_size=integers(min_value=1, max_value=2**12),
      mode=sampled_from(list(brotlicffi.BrotliEncoderMode)),
      quality=integers(min_value=0, max_value=11),
      lgwin=integers(min_value=10, max_value=24),
      lgblock=one_of(
          integers(min_value=0, max_value=0),
          integers(min_value=16, max_value=24)
      ),
  )
  def test_streaming_compression_flush(one_compressed_file,
E       fixture 'one_compressed_file' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_compression.py:67
_____________________ ERROR at setup of test_decompression _____________________
file /tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_decompression.py, line 13
  def test_decompression(simple_compressed_file):
E       fixture 'simple_compressed_file' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_decompression.py:13
_____________________ ERROR at setup of test_decompressobj _____________________
file /tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_decompression.py, line 26
  def test_decompressobj(simple_compressed_file):
E       fixture 'simple_compressed_file' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_decompression.py:26
_______________________ ERROR at setup of test_drip_feed _______________________
file /tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_decompression.py, line 41
  def test_drip_feed(simple_compressed_file):
E       fixture 'simple_compressed_file' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/tmp/guix-build-python-brotlicffi-1.1.0.0.drv-0/brotlicffi-1.1.0.0/test/test_simple_decompression.py:41
=========================== short test summary info ============================
ERROR test/test_simple_compression.py::test_roundtrip_compression_with_files
ERROR test/test_simple_compression.py::test_streaming_compression
ERROR test/test_simple_compression.py::test_streaming_compression_flush
ERROR test/test_simple_decompression.py::test_decompression
ERROR test/test_simple_decompression.py::test_decompressobj
ERROR test/test_simple_decompression.py::test_drip_feed
================== 13 passed, 1 deselected, 6 errors in 0.39s ==================

A workaround:
pytest --noconftest --ignore=test/test_simple_compression.py --ignore=test/test_simple_decompression.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant