-
Notifications
You must be signed in to change notification settings - Fork 58
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
move conftest contents to asdf/conftest #1645
Conversation
yes I was wondering why the |
Thanks! That sounds believable. I tried looking through the various action and log files and didn't see anything obvious. Perhaps we should be installing the package from pip and running tests as part of maybe the weekly cron. Does that seem worthwhile? |
We can try making a |
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def _temp_cwd(tmpdir_factory): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what's going on, or if it really matters, but tese changes are causing some test failures when asdf is installed in editable mode. For example pytest fails on a code block in the docs/asdf/config.rst file:
$ pytest docs/asdf/config.rst
================================================================================================ test session starts =================================================================================================
platform darwin -- Python 3.10.8, pytest-7.2.0, pluggy-1.0.0
Matplotlib: 3.6.2
Freetype: 2.6.1
rootdir: /Users/eslavich/repos/asdf, configfile: pyproject.toml
plugins: remotedata-0.4.0, hypothesis-6.70.0, mock-3.10.0, filter-subpackage-0.1.2, requests-mock-1.10.0, mpl-0.16.1, astropy-header-0.2.2, doctestplus-0.12.1, astropy-0.10.0, cov-4.0.0, ci-watson-0.6.1, openfiles-0.5.0, anyio-3.6.2, asdf-3.0.0.dev600+g02752c84, arraydiff-0.5.0, httpserver-1.0.6
collected 1 item
docs/asdf/config.rst F [100%]
====================================================================================================== FAILURES ======================================================================================================
________________________________________________________________________________________________ [doctest] config.rst ________________________________________________________________________________________________
027 --------------------------------
028
029 There are two methods available that give access to an `AsdfConfig` instance:
030 `~asdf.get_config` and `~asdf.config_context`. The former simply returns
031 the currently active config:
032
033 .. code-block:: pycon
034
035 >>> import asdf
036 >>> asdf.get_config()
UNEXPECTED EXCEPTION: AttributeError("module 'asdf' has no attribute 'get_config'")
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniconda/base/envs/asdf/lib/python3.10/doctest.py", line 1350, in __run
exec(compile(example.source, filename, "single",
File "<doctest config.rst[3]>", line 1, in <module>
AttributeError: module 'asdf' has no attribute 'get_config'
/Users/eslavich/repos/asdf/docs/asdf/config.rst:36: UnexpectedException
============================================================================================== short test summary info ===============================================================================================
FAILED docs/asdf/config.rst::config.rst
================================================================================================= 1 failed in 0.07s ==================================================================================================
but when I restore the conftest.py file it works:
$ git checkout main -- conftest.py
$ pytest docs/asdf/config.rst
================================================================================================ test session starts =================================================================================================
platform darwin -- Python 3.10.8, pytest-7.2.0, pluggy-1.0.0
Matplotlib: 3.6.2
Freetype: 2.6.1
rootdir: /Users/eslavich/repos/asdf, configfile: pyproject.toml
plugins: remotedata-0.4.0, hypothesis-6.70.0, mock-3.10.0, filter-subpackage-0.1.2, requests-mock-1.10.0, mpl-0.16.1, astropy-header-0.2.2, doctestplus-0.12.1, astropy-0.10.0, cov-4.0.0, ci-watson-0.6.1, openfiles-0.5.0, anyio-3.6.2, asdf-3.0.0.dev600+g02752c84, arraydiff-0.5.0, httpserver-1.0.6
collected 1 item
docs/asdf/config.rst . [100%]
================================================================================================= 1 passed in 2.09s ==================================================================================================
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzling... I'm not sure what's happening there either. I tried testing this locally and that tests (and all other tests) pass without issue for an editable install (installed with pip install -e .
).
Did the environment previously have asdf installed? Based on the error you saw AttributeError: module 'asdf' has no attribute 'get_config'
it might be that the pytest plugin of the old installation left behind a 'ghost' namespace (see: #790) but I'm not sure how restoring the conftest.py
would fix this :-/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, oops, good call -- I tried again with a fresh environment and didn't run into the same problem.
02752c8
to
12f1e5c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
12f1e5c
to
26ab368
Compare
move conftest contents to asdf/conftest
@zacharyburnett this fix is now in the released 2.15.2 version. Testing with |
As mentioned here: #1614 (comment)
asdf tests for the installed package (for example 2.15.1 on pypi) do not run when run with
pytest --pyargs asdf
with the following error:This appears to be due to change in #1591 which register a
jsonschema
config for pytest in aconftest.py
that is not included with the installed package.This PR moves the contents of
conftest.py
(which is not included in the installed package) toasdf/conftest.py
(which is included in the installed package).I tested this locally and it appears to fix the issue. Given the note below about the CI failing to catch this (even though it looks like it should) makes me not trust the CI as a judge of this PR.
@zacharyburnett any clue why the
package
CI that is run on PRs didn't catch this:asdf/.github/workflows/ci.yml
Lines 105 to 112 in b14591c
It appears to build the packge, install it, cd to a temp directory and run the same command as above:
https://github.com/asdf-format/asdf/actions/runs/6146839026/job/16677609197#step:7:1246
Perhaps it's because it's using a sdist instead of a wheel? EDIT: tests also appear to pass with the wheel: https://github.com/asdf-format/asdf/actions/runs/6146839026/job/16677609197#step:7:4231