pytest icon indicating copy to clipboard operation
pytest copied to clipboard

Fixture not found in 8.0 that is found in 7.4.4

Open larsoner opened this issue 1 year ago • 6 comments

In this run:

https://github.com/openmeeg/openmeeg/actions/runs/7700673043/job/20985097864?pr=631#step:6:8200

You can see the 3.7 wheel work during testing (which uses 7.4.4), but fail in 3.8 testing (which uses 8.0.0). If I use pytest --fixtures $TEST_PATH the fixture is there:

  ---------------- fixtures defined from openmeeg.tests.conftest ----------------
  data_path [session scope] -- ..\venv-test\lib\site-packages\openmeeg\tests\conftest.py:15
      no docstring available
  
  run_some_parallel [session scope] -- ..\venv-test\lib\site-packages\openmeeg\tests\conftest.py:27
      Run some stuff in parallel.

But when I run the tests with pytest --tb=short -ra -m 'not slow' -vv $TEST_PATH I get for all tests:

  ============================= test session starts =============================
  platform win32 -- Python 3.8.10, pytest-8.0.0, pluggy-1.4.0 -- C:\Users\runneradmin\AppData\Local\Temp\cibw-run-32upad1x\cp38-win_amd64\venv-test\Scripts\python.exe
  cachedir: .pytest_cache
  rootdir: C:\Users\runneradmin\AppData\Local\Temp\cibw-run-32upad1x\cp38-win_amd64
  collecting ... collected 13 items / 2 deselected / 11 selected
  
  ..\venv-test\Lib\site-packages\openmeeg\tests\test_doc.py::test_doc <- venv-test\lib\site-packages\openmeeg\tests\test_doc.py ERROR [  9%]

...

  =================================== ERRORS ====================================
  _________________________ ERROR at setup of test_doc __________________________
  file C:\Users\runneradmin\AppData\Local\Temp\cibw-run-32upad1x\cp38-win_amd64\venv-test\lib\site-packages\openmeeg\tests\test_doc.py, line 6
    def test_doc():
  E       fixture 'run_some_parallel' 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.

Notably, this only happens on the Windows cibuildwheel run -- the Linux one in that same GHA is green. So the issue seems isolated to 8.0.0 on Windows. Nonetheless I am a bit mystified at why pytest --fixtures seems to see a different set of fixtures compared to 7.4.4 :shrug:

  • [x] a detailed description of the bug or problem you are having
  • [x] pytest and operating system versions
  • [ ] output of pip list from the virtual environment you are using
  • [ ] minimal example if possible

Not sure how to make this one mimimal but I could put some time into this on my Windows VM at some point if it's not clear enough what's going on.

larsoner avatar Jan 29 '24 18:01 larsoner

(Oh and it shouldn't be a 3.7 vs 3.8 thing because things were fine last week on these same runs!)

larsoner avatar Jan 29 '24 18:01 larsoner

It looks like the conftest is not getting loaded since the data_path also doesn't show up in the "available fixtures". This is probably related to annoying Windows path stuff.

I can probably reconstruct things from above but just to make things easier for me:

  • What is $TEST_PATH in the example?
  • What is the current directory from which pytest is invoked?
  • Where is the pytest config file located (if any)?

Unrelated, but I'm curious: is there a reason you're doing this:

https://github.com/openmeeg/openmeeg/blob/331759d15006fbdf1ff13842baa435ae87c8ef19/wrapping/python/openmeeg/tests/conftest.py#L10

instead of making the fixture autouse=True?

bluetech avatar Jan 30 '24 11:01 bluetech

I can probably reconstruct things from above but just to make things easier for me:

From a new GHA run in a PR sandbox (where I could eventually test a fix branch if you want):

  • $TEST_PATH is 'C:\Users\runneradmin\AppData\Local\Temp\cibw-run-iplgjl8i\cp39-win_amd64\venv-test\lib\site-packages\openmeeg'
  • pwd (running in a bash script) is /c/Users/runneradmin/AppData/Local/Temp/cibw-run-iplgjl8i/cp39-win_amd64/test_cwd
  • pytest config file is in C:\Users\runneradmin\AppData\Local\Temp\cibw-run-iplgjl8i\cp39-win_amd64\venv-test\lib\site-packages\openmeeg\tests\conftest.py, found by pytest --fixtures $TEST_PATH as ..\venv-test\lib\site-packages\openmeeg\tests\conftest.py

Unrelated, but I'm curious: is there a reason you're doing this:

Last year when I wrote this I didn't understand autouse=True. Thanks for the reminder, I'll remove it!

larsoner avatar Jan 30 '24 14:01 larsoner

@larsoner We've fixed some windows regressions, could you try again with latest main? I suspect it won't fix the issue but maybe it will.

bluetech avatar Feb 23 '24 13:02 bluetech

Looks like on commit b510adf9efcd21e7ff2ab8e93e925f3e8363bb7d just now the failure is still there :disappointed:

larsoner avatar Feb 23 '24 15:02 larsoner

OK, so keeping this on the radar, thanks for checking.

bluetech avatar Feb 23 '24 20:02 bluetech