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

python3Packages.sopel: 7.0.5 -> 7.0.6 #95689

Merged
merged 4 commits into from Aug 18, 2020
Merged

python3Packages.sopel: 7.0.5 -> 7.0.6 #95689

merged 4 commits into from Aug 18, 2020

Conversation

mweinelt
Copy link
Member

Motivation for this change

Noticed it was broken in #95673 (comment).

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@mweinelt
Copy link
Member Author

I'm currently having issues with the test suite and am looking for help. Reported the issue upstream at sopel-irc/sopel#1926.

============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-5.4.3, py-1.8.2, pluggy-0.13.1 -- /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/bin/python3.8
cachedir: .pytest_cache
rootdir: /build/sopel-7.0.6
plugins: sopel-7.0.6
collected 215 items / 1 error / 214 selected

==================================== ERRORS ====================================
_____________________ ERROR collecting sopel/test_tools.py _____________________
import file mismatch:
imported module 'sopel.test_tools' has this __file__ attribute:
  /nix/store/apl4l88a2vy1d7m6d46ncimcqgcz9xqa-python3.8-sopel-7.0.6/lib/python3.8/site-packages/sopel/test_tools.py
which is not the same as the test file we want to collect:
  /build/sopel-7.0.6/sopel/test_tools.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
=========================== short test summary info ============================
ERROR sopel/test_tools.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 1.07s ===============================

@mweinelt mweinelt changed the title sopel: 7.0.5 -> 7.0.6 python3Packages.sopel: 7.0.5 -> 7.0.6 Aug 17, 2020
@ofborg ofborg bot requested a review from mogorman August 17, 2020 14:36
@drewrisinger
Copy link
Contributor

@mweinelt Here's what I think is happening:

  1. Nix builds sopel package
  2. Nix installs sopel package to $out
  3. checkPhase runs pytest in $sourceRoot
  4. Pytest finds "tests" in ./sopel && ./test. "Test" in ./sopel is a mistake due to naming convention, test_tools.py registers as a file that pytest wants to run (matches test_*.py pattern). This part could be fixed by running pytest ./test in checkPhase.
  5. file conflict is due to finding sopel/test_tools.py in two file locations: $out/.../sopel, and $sourceRoot (actually $TMP/$sourceRoot)/sopel/...

An aside, I generally recommend using pytestCheckHook:

{
...
, pytestCheckHook
, ...
}:

buildPythonPackage {
  checkInputs = [ pytestCheckHook];
  pytestFlagsArray = [ "./test" ]; # prevent finding "test" in ./sopel/test_tools.py
}

If that doesn't work, my other suggestion is make a temp dir and move the tests to that:

(using pytestCheckHook as above)
preCheck = ''
  export TESTDIR=$(mktemp -d)
  cp -r ./test $TESTDIR
  pushd $TESTDIR
'';
postCheck = "popd";

@mweinelt
Copy link
Member Author

Thanks, that explanation helped!

@mweinelt mweinelt marked this pull request as ready for review August 18, 2020 10:16
@mweinelt
Copy link
Member Author

No space left on device 🤷

@drewrisinger
Copy link
Contributor

No space left on device 🤷

Have you run nix-collect-garbage recently? I keep freeing up 10s of GBs using that from running nix-review all the time.

A few packages don't build with this as-is due to mocket build failures:

$ nix-review pr 95689:

https://github.com/NixOS/nixpkgs/pull/95689
4 packages failed to build:
python27Packages.mocket python37Packages.geoip2 python37Packages.mocket python37Packages.sopel

6 packages built:
python37Packages.maxminddb python38Packages.geoip2 python38Packages.maxminddb python38Packages.mocket python38Packages.sopel zeronet

Mocket might be able to be disabled on python2:

{ ...
, isPy3k
, ...
}:

buildPythonPackage {
  disabled = ! isPy3k;
}

Last log lines from failed mocket builds:

builder for '/nix/store/k34nyxsvlihrx17sd7scz84sz3df8r61-python2.7-mocket-3.8.7.drv' failed with exit code 1; last 10 log lines:
      replace_conflicting=replace_conflicting
    File "/nix/store/gz139sqlwiyycgbw1hws53q1c2v2vfa4-python2.7-setuptools-44.0.0/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
      return self.obtain(req, installer)
    File "/nix/store/gz139sqlwiyycgbw1hws53q1c2v2vfa4-python2.7-setuptools-44.0.0/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
      return installer(requirement)
    File "/nix/store/gz139sqlwiyycgbw1hws53q1c2v2vfa4-python2.7-setuptools-44.0.0/lib/python2.7/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
      return fetch_build_egg(self, req)
    File "/nix/store/gz139sqlwiyycgbw1hws53q1c2v2vfa4-python2.7-setuptools-44.0.0/lib/python2.7/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
      raise DistutilsError(str(e))
  distutils.errors.DistutilsError: Command '['/nix/store/6xyf4rb6ch0xgf6c7x2p0g6l6k76yqn2-python-2.7.18/bin/python2.7', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/build/tmpzo20Gd', '--quiet', 'pipenv']' returned non-zero exit status 1
builder for '/nix/store/pqh0as41fqx8qqa2gih7rnz1wl4lawdf-python3.7-mocket-3.8.7.drv' failed with exit code 1; last 10 log lines:
      replace_conflicting=replace_conflicting
    File "/nix/store/z00af9n2g82fiw3yqhdzhh6bm90x5b3n-python3.7-setuptools-47.3.1/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
      return self.obtain(req, installer)
    File "/nix/store/z00af9n2g82fiw3yqhdzhh6bm90x5b3n-python3.7-setuptools-47.3.1/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
      return installer(requirement)
    File "/nix/store/z00af9n2g82fiw3yqhdzhh6bm90x5b3n-python3.7-setuptools-47.3.1/lib/python3.7/site-packages/setuptools/dist.py", line 754, in fetch_build_egg
      return fetch_build_egg(self, req)
    File "/nix/store/z00af9n2g82fiw3yqhdzhh6bm90x5b3n-python3.7-setuptools-47.3.1/lib/python3.7/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
      raise DistutilsError(str(e))
  distutils.errors.DistutilsError: Command '['/nix/store/9hdzs3g6rb76grwzlsbxyxwxg2n0fl4a-python3-3.7.8/bin/python3.7', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/build/tmpxdi3ysc3', '--quiet', 'pipenv']' returned non-zero exit status 1.

@mweinelt
Copy link
Member Author

mweinelt commented Aug 18, 2020

Have you run nix-collect-garbage recently? I keep freeing up 10s of GBs using that from running nix-review all the time.

I'm talking about ofBorg :)

Looking into the other issues asap.

@mweinelt
Copy link
Member Author

Sorted.

Result of nixpkgs-review pr 95689 1

10 packages built:
- python27Packages.mocket
- python37Packages.geoip2
- python37Packages.maxminddb
- python37Packages.mocket
- python37Packages.sopel
- python38Packages.geoip2
- python38Packages.maxminddb
- python38Packages.mocket
- python38Packages.sopel
- zeronet

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff LGTM

https://github.com/NixOS/nixpkgs/pull/95689
10 packages built:
python27Packages.mocket python37Packages.geoip2 python37Packages.maxminddb python37Packages.mocket python37Packages.sopel python38Packages.geoip2 python38Packages.maxminddb python38Packages.mocket python38Packages.sopel zeronet

@jonringer
Copy link
Contributor

is ofborg dead?

Copy link
Contributor

@drewrisinger drewrisinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments.

pkgs/development/python-modules/mocket/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/mocket/default.nix Outdated Show resolved Hide resolved
Comment on lines +31 to +33
# Pypi has no runtests.py, github has no requirements.txt. No way to test, no way to install.
doCheck = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe file an upstream issue?

Also, it looks like the runtest.py basically just runs pytest, and the tests are included in the PyPi sdist. So maybe just try running pytestCheckHook?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally a tox.ini or the test_requires section of setup.py will mention what is needed.

However, this does a non-standard construction. Needs xxhash aiohttp and async-timeout
https://github.com/mindflayer/python-mocket/blob/fb24872ae2a530dad0e645e3e9c39dcea29e999d/runtests.py#L22

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing mocket requires packaging of pook, which requires mocket for testing.

Boom. Infinite loop.

I only ever wanted to fixup those packages, not maintain them 😞

Comment on lines +51 to 53
postCheck = ''
popd
'';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
postCheck = ''
popd
'';
postCheck = "popd";

pkgs/development/python-modules/geoip2/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/sopel/default.nix Outdated Show resolved Hide resolved
Copy link
Member Author

@mweinelt mweinelt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is ofborg dead?

@jonringer Yeah, graham is on vacation and cole and LnL apparently can't fix this.

@jonringer
Copy link
Contributor

@jonringer Yeah, graham is on vacation and cole and LnL apparently can't fix this.

build and test command seems to work. just eval isn't working... which I guess is what it normally does xD

@mweinelt mweinelt force-pushed the sopel branch 3 times, most recently from c0ea40b to a36b856 Compare August 18, 2020 20:23
@mweinelt
Copy link
Member Author

Result of nixpkgs-review pr 95689 1

10 packages built:
- python27Packages.mocket
- python37Packages.geoip2
- python37Packages.maxminddb
- python37Packages.mocket
- python37Packages.sopel
- python38Packages.geoip2
- python38Packages.maxminddb
- python38Packages.mocket
- python38Packages.sopel
- zeronet

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Result of nixpkgs-review pr 95689 1

10 packages built:
- python27Packages.mocket
- python37Packages.geoip2
- python37Packages.maxminddb
- python37Packages.mocket
- python37Packages.sopel
- python38Packages.geoip2
- python38Packages.maxminddb
- python38Packages.mocket
- python38Packages.sopel
- zeronet

@jonringer jonringer merged commit 2addc08 into NixOS:master Aug 18, 2020
@mweinelt mweinelt deleted the sopel branch August 18, 2020 21:18
jonringer added a commit to jonringer/python-mocket that referenced this pull request Aug 18, 2020
pipenv should not be required for sdist installations.

noticed this behavior when reviewing NixOS/nixpkgs#95689
mindflayer pushed a commit to mindflayer/python-mocket that referenced this pull request Aug 19, 2020
pipenv should not be required for sdist installations.

noticed this behavior when reviewing NixOS/nixpkgs#95689
@drewrisinger drewrisinger mentioned this pull request Aug 24, 2020
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants