question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import xarray.tests due to use of pytest.config

See original GitHub issue

xarray.tests cannot be imported due to the use of pytest.config:

$ python -c "import xarray; print(xarray.__version__); import xarray.tests"
0.9.2-3-g9479038
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/jhelmus/devel/xarray/xarray/tests/__init__.py", line 118, in <module>
    not pytest.config.getoption("--run-flaky"),
AttributeError: module 'pytest' has no attribute 'config'

The use of pytest.config in the xarray/tests/__init__.py seem to have been introduced in #1336. From the discussion in pytest-dev/pytest#1688 it seems as if the use of pytest.config is discouraged.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jjhelmuscommented, Apr 6, 2017

Just out of curiosity, what reason did you have for importing xarray.tests?

xarray.tests is listed as a import test in the conda-forge xarray-feedstock and was failing when I was doing a build. I do not think that import line needs to be present, tests does not seem to be in the public API of xarray. I’d be in favor of removing that line and keeping the test suite setup as-is.

0reactions
jjhelmuscommented, Apr 6, 2017

@shoyer Agreed, there is no need for xarray.tests to be importable. Closing this issue, thanks for the quick clarification.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pytest cannot import module while python can - Stack Overflow
I'm using this from VS Code, in the test explorer under Windows in a conda environment, Python 3.8. The setup I have got...
Read more >
What's New - Xarray
This release brings a number of bug fixes and improvements, most notably a major internal refactor of the indexing functionality, the use of...
Read more >
Full pytest documentation
Install pytest · Create your first test · Run multiple tests · Assert that a certain exception is raised · Group multiple tests...
Read more >
Scientific Computing | SciVision
import xarray import xarray.tests ; # run your simulation etc. dat = myfunc(...) ; # load the reference Dataset to compare against ref...
Read more >
[Fixed] ModuleNotFoundError: No module named 'importlib ...
The most likely reason is that Python doesn't provide importlib-metadata in its standard library. You need to install it first! ... Before being...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found