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.

[BUG] 1.8.0: pytest is failing in 5 units

See original GitHub issue

Describe your issue.

Looks lik epytest is failing in few units.

Reproducing Code Example

I'm trying to package 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`
- because I'm calling `build` with `--no-isolation` I'm using during all processes only locally installed modules
- install .whl file in </install/prefix>
- run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Error message

will include in next comment.

SciPy/NumPy/Python version information

scipy 1.8.0, python 3.8.13

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:21 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
ev-brcommented, May 9, 2022

$ python dev.py or $ python runtests.py from the scipy root. Or, $ pytest --pyargs scipy to test already-installed version away from the repo root folder.

0reactions
rgommerscommented, May 9, 2022

The first failure is from a test using subprocess.check_call([sys.executable, '-c', TEST_BODY]). So it runs into exactly the failure mode you apparently already understand. The output really cannot be clearer:

ImportError: Error importing SciPy: you cannot import SciPy while
        being in scipy source directory; please exit the SciPy source
        tree first and relaunch your Python interpreter.

There’s only one way to get that output, which is running tests from the root of the repo. This is wrong, no matter how you invoke pytest; that invocation method does not carry over to the fresh process created by subprocess.check_call it looks like.

Now it would be really nice if you actually confirmed that doing cd .. and rerunning the tests will make those failures go away. And by “really nice” I mean “you’re breaking open source etiquette by not even trying the solution that a maintainer has suggested to you”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog — pytest documentation
Fixes a crash during a failed teardown in unittest TestCases with ... 2 values: E Index | Obtained | Expected E 1 |...
Read more >
Lesson 16: Examples of TDD
To explore another feature of pytest , we'll consider another aspect of our number_negatives() function. Specifically, what should we do if an invalid...
Read more >
Testing - Best practices in software engineering - milliams.com
In Python this "small unit of code" is usually a function. ... If we had five test functions in our file and three...
Read more >
pytest-cov - PyPI
Pytest plugin for measuring coverage. ... Fix bug hiding test failure when cov-fail-under failed. For coverage >= 4.0, match the default behaviour of ......
Read more >
Dibya Chakravorty - DataCamp
If function is buggy and does not raise ValueError , test will fail. Page 27. UNIT TESTING FOR DATA SCIENCE IN PYTHON. Testing...
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