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

pytest: do not store .pytest_cache in $out #40273

Closed
FRidh opened this issue May 10, 2018 · 13 comments
Closed

pytest: do not store .pytest_cache in $out #40273

FRidh opened this issue May 10, 2018 · 13 comments
Assignees
Labels
0.kind: bug 6.topic: python 9.needs: port to stable A PR needs a backport to the stable release.
Milestone

Comments

@FRidh
Copy link
Member

FRidh commented May 10, 2018

Issue description

In #40259 a collision of .pytest_cache files was reported. These files should not exist in the first place.

They only seem to be introduced when running pytest with $out as target, so

pytest $out
@FRidh
Copy link
Member Author

FRidh commented May 10, 2018

Occurrences:

$ git grep 'py.test $out'
pkgs/development/python-modules/autobahn/default.nix:    py.test $out
pkgs/development/python-modules/cairocffi/default.nix:    py.test $out/${python.sitePackages}
pkgs/development/python-modules/hyperlink/default.nix:    py.test $out
pkgs/development/python-modules/pandas/default.nix:    py.test $out/${python.sitePackages}/pandas --skip-slow --skip-network \
pkgs/development/python-modules/pyzmq/default.nix:    py.test $out/${python.sitePackages}/zmq/ -k "not test_socket \
pkgs/development/python-modules/spake2/default.nix:    py.test $out
pkgs/development/python-modules/xarray/default.nix:    py.test $out/${python.sitePackages}
pkgs/top-level/python-packages.nix:      py.test $out/${python.sitePackages}
pkgs/top-level/python-packages.nix:      py.test $out
pkgs/top-level/python-packages.nix:      py.test $out
pkgs/top-level/python-packages.nix:      py.test $out/${python.sitePackages}

@FRidh
Copy link
Member Author

FRidh commented May 10, 2018

Quoting from #40259 (comment):

Just adding for searchability/reference: et_xmlfile still includes this, and pytest could alternatively be called like py.test -p no:cacheprovider $out if we don't want this cache dir created at all.

FRidh added a commit that referenced this issue Jul 22, 2018
…lder, fixes #40273

When `py.test` was run with a folder as argument, it would not only
search for tests in that folder, but also create a .pytest-cache folder.
Not only is this state we don't want, but it was also causing
collisions.
@FRidh
Copy link
Member Author

FRidh commented Jul 22, 2018

Fix in 610485f

@FRidh
Copy link
Member Author

FRidh commented Aug 5, 2018

Seems like the issue is still present (#44479):

nix-shell -p 'python3.withPackages(ps: with ps; [ cairocffi tinycss ])' -I nixpkgs=.

@FRidh FRidh reopened this Aug 5, 2018
@FRidh
Copy link
Member Author

FRidh commented Aug 5, 2018

Looks like a typo; it should be .pytest_cache and not .pytest-cache.

@vcunat vcunat closed this as completed in 9267b47 Aug 17, 2018
@lopsided98
Copy link
Contributor

This doesn't seem to fix the problem, because fixupPhase is run before installCheckPhase, which is where python packages run their tests.

@FRidh
Copy link
Member Author

FRidh commented Sep 1, 2018

It is indeed the incorrect phase, I forgot about the order. The solution is to use postCheckHooks instead. However, it is important that when checkPhase is overridden, the postHook is still ran. Here we could use NixOS/rfcs#32.

@FRidh
Copy link
Member Author

FRidh commented Sep 2, 2018

New solution adding a new phase: #45898

@FRidh
Copy link
Member Author

FRidh commented Oct 2, 2018

Latest fix landed in master. Now, it still needs to be backported.

@FRidh FRidh added the 9.needs: port to stable A PR needs a backport to the stable release. label Oct 2, 2018
@FRidh
Copy link
Member Author

FRidh commented Oct 13, 2018

I've pushed the fixes to staging-18.09. Now we need to wait for that to land in release-18.09.

@matthewbauer
Copy link
Member

Looks to now have landed.

@alexeymuranov
Copy link
Contributor

@matthewbauer , are you sure? I do not see staging-18.09 merged into release-18.09 since a while...

@alexeymuranov
Copy link
Contributor

alexeymuranov commented Nov 8, 2018

The related #47285 is still an issue on 18.09.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 6.topic: python 9.needs: port to stable A PR needs a backport to the stable release.
Projects
None yet
Development

No branches or pull requests

4 participants