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

xdot: fix tests #107872

Merged

Conversation

r-k-b
Copy link
Contributor

@r-k-b r-k-b commented Dec 29, 2020

nix-shell -p xdot was failing, with an error like:

builder for '/nix/store/n3yjqssn531c52sbkmpqvczmy5c0lm8n-python3.8-xdot-1.2.drv' failed with exit code 1; last 10 log lines:
      import numpy
  ModuleNotFoundError: No module named 'numpy'

Adding numpy uncovered another error, about not being able to initialize gtk:

error: Test failed: <unittest.runner.TextTestResult run=1 errors=1 failures=0>
error: --- Error -------------------------------------------------------------------------------------------------------------------------------------------- nix-shell
builder for '/nix/store/brz6q1ri12z51z3l2p5d6ny2jsf3qkjg-python3.8-xdot-1.2.drv' failed with exit code 1; last 10 log lines:
      raise RuntimeError(
  RuntimeError: Gtk couldn't be initialized. Use Gtk.init_check() if you want to handle this case.

Changes based on: pkgs/applications/networking/flent/default.nix

Motivation for this change

I tried to use the package with nix-shell -p xdot, and it didn't work.

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.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

Please change the PR and commit message to something like xdot: fix tests

pkgs/development/python-modules/xdot/default.nix Outdated Show resolved Hide resolved
@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 107872 run on x86_64-darwin 1

3 packages failed to build:
  • python37Packages.xdot
  • xdot (python38Packages.xdot)
  • python39Packages.xdot
running install tests
/nix/store/31nmzyyrmbd003ahhkppmm6d056zd21x-xvfb-run/bin/.xvfb-run-wrapped: line 159: mcookie: command not found

@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 107872 run on x86_64-linux 1

3 packages built:
  • python37Packages.xdot
  • xdot (python38Packages.xdot)
  • python39Packages.xdot

Please add doCheck = false; and a pythonImportsCheck.

python37Packages.xdot.log
181:Ran 0 tests in 0.000s

xdot.log
181:Ran 0 tests in 0.000s

python39Packages.xdot.log
181:Ran 0 tests in 0.000s

@r-k-b r-k-b force-pushed the fix-xdot-numpy-and-gtk-test-dependencies branch 2 times, most recently from a152723 to 9a81e38 Compare December 29, 2020 23:27
@r-k-b r-k-b changed the title xdot: fix 1.2 not building xdot: fix tests Dec 29, 2020
@r-k-b r-k-b force-pushed the fix-xdot-numpy-and-gtk-test-dependencies branch from 9a81e38 to 8a3bf1a Compare December 29, 2020 23:52
@r-k-b
Copy link
Contributor Author

r-k-b commented Dec 30, 2020

Please add doCheck = false; and a pythonImportsCheck.

I'm unsure about this part, @SuperSandro2000... does this help?

@jonringer jonringer mentioned this pull request Dec 31, 2020
10 tasks
@rmcgibbo
Copy link
Contributor

I'm closing #108020 in favor of this, but feel free to take anything from that way of fixing it if you prefer.

@r-k-b r-k-b force-pushed the fix-xdot-numpy-and-gtk-test-dependencies branch from 8a3bf1a to 2d091ed Compare January 1, 2021 00:25
@r-k-b
Copy link
Contributor Author

r-k-b commented Jan 1, 2021

I've removed the pythonImportsCheck line as it fails to initialise gtk when that's present. I'm not sure why, as it seems to use the custom checkPhase. Is something else trying to run the tests outside xvfb-run?
Should we somehow wrap python-imports-check-hook.sh with xvfb-run?

Executing pythonImportsCheckPhase
Check whether the following modules can be imported: xdot
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 1, in <lambda>
  File "/nix/store/m7080pw0ryjk0jhljp55rq1hd2qy8gki-python3-3.8.6/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/nix/store/62jwz83lpwbm2sqph37fc65ji7r89xn0-python3.8-xdot-1.2/lib/python3.8/site-packages/xdot/__init__.py", line 26, in <module>
    from . import ui
  File "/nix/store/62jwz83lpwbm2sqph37fc65ji7r89xn0-python3.8-xdot-1.2/lib/python3.8/site-packages/xdot/ui/__init__.py", line 3, in <module>
    from .window import DotWidget, DotWindow
  File "/nix/store/62jwz83lpwbm2sqph37fc65ji7r89xn0-python3.8-xdot-1.2/lib/python3.8/site-packages/xdot/ui/window.py", line 40, in <module>
    from . import actions
  File "/nix/store/62jwz83lpwbm2sqph37fc65ji7r89xn0-python3.8-xdot-1.2/lib/python3.8/site-packages/xdot/ui/actions.py", line 66, in <module>
    class NullAction(DragAction):
  File "/nix/store/62jwz83lpwbm2sqph37fc65ji7r89xn0-python3.8-xdot-1.2/lib/python3.8/site-packages/xdot/ui/actions.py", line 70, in NullAction
    _tooltip_window = Gtk.Window(Gtk.WindowType.POPUP)
  File "/nix/store/8xpk06wi1f0c5907bjmw521snbiaingg-python3.8-pygobject-3.38.0/lib/python3.8/site-packages/gi/overrides/Gtk.py", line 515, in __init__
    raise RuntimeError(
RuntimeError: Gtk couldn't be initialized. Use Gtk.init_check() if you want to handle this case.

If it's not necessary to have pythonImportsCheck, this PR is ready for review.

@SuperSandro2000
Copy link
Member

This is a semi-automatic executed nixpkgs-review. If you find some bugs or got suggestions for further things to search or run please reach out to SuperSandro2000 on IRC.

Result of nixpkgs-review pr 107872 run on x86_64-linux 1

2 packages failed to build and are new build failures:
  • python37Packages.xdot
  • python39Packages.xdot
1 package built:
  • xdot (python38Packages.xdot)

The following issues got detected with the above build packages.
Please fix at least the ones listed with your changed packages:

xdot.log:

Zero tests run by pytest got detected: 'Ran 0 tests in 0.000s'
You have the following options to fix this:

  • Tell pytest(CheckHook) where to find the tests included in the package
  • Check if the GitHub Repo contains tests but they are not shipped with Pypi. If so please switch to fetchFromGitHub.
  • If the Packages does not contain any tests add 'doCheck = false;'and apythonImportsCheck`.

`nix-shell -p xdot` was failing, with an error like:

    builder for '/nix/store/n3yjqssn531c52sbkmpqvczmy5c0lm8n-python3.8-xdot-1.2.drv' failed with exit code 1; last 10 log lines:
          import numpy
      ModuleNotFoundError: No module named 'numpy'

Adding numpy uncovered another error, about not being able to initialize
gtk:

    error: Test failed: <unittest.runner.TextTestResult run=1 errors=1 failures=0>
    error: --- Error -------------------------------------------------------------------------------------------------------------------------------------------- nix-shell
    builder for '/nix/store/brz6q1ri12z51z3l2p5d6ny2jsf3qkjg-python3.8-xdot-1.2.drv' failed with exit code 1; last 10 log lines:
          raise RuntimeError(
      RuntimeError: Gtk couldn't be initialized. Use Gtk.init_check() if you want to handle this case.
@r-k-b r-k-b force-pushed the fix-xdot-numpy-and-gtk-test-dependencies branch from 2d091ed to 6d355e4 Compare January 1, 2021 06:55
@SuperSandro2000
Copy link
Member

This is a semi-automatic executed nixpkgs-review which does not build all packages (e.g. lumo, tensorflow or pytorch)
If you find some bugs or got suggestions for further things to search or run please reach out to SuperSandro2000 on IRC.

Result of nixpkgs-review pr 107872 run on x86_64-darwin 1

3 packages built:
  • python37Packages.xdot
  • xdot (python38Packages.xdot)
  • python39Packages.xdot

@SuperSandro2000 SuperSandro2000 merged commit 590feee into NixOS:master Jan 3, 2021
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

4 participants