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

pythonPackages.sh: fix tests on Python 3.7 #52607

Merged
merged 2 commits into from Dec 22, 2018

Conversation

lopsided98
Copy link
Contributor

There is some new Unicode related issue introduced by Python 3.7, which causes a test to fail. I attempted to fix it using glibcLocales and LC_ALL=en_US.UTF-8, but this did not work.

Python 3.7 has some Unicode related changes, but I don't see how they would cause this problem.

I have been unable to reproduce this error outside of the Nix build, which indicates that this probably won't cause issues for users.

Here is the error message:

======================================================================
ERROR: test_unicode_path (test.MiscTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/sh-1.12.14/test.py", line 2787, in test_unicode_path
    running = cmd()
  File "/build/sh-1.12.14/sh.py", line 1427, in __call__
    return RunningCommand(cmd, call_args, stdin, stdout, stderr)
  File "/build/sh-1.12.14/sh.py", line 774, in __init__
    self.wait()
  File "/build/sh-1.12.14/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/build/sh-1.12.14/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_255:

  RAN: /build/字rkwbp4f1

  STDOUT:


  STDERR:


----------------------------------------------------------------------
Ran 156 tests in 44.088s

FAILED (errors=1, skipped=1)
Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@FRidh
Copy link
Member

FRidh commented Dec 21, 2018

Did you report the issue upstream? I would prefer if you disable the single test.

@lopsided98
Copy link
Contributor Author

The issue is that the test uses /usr/bin/env python, which isn't available in the build sandbox. On versions of Python older than 3.7, this test was skipped because a UTF-8 locale was not configured, but Python 3.7 changed so that it uses UTF-8 even if the system does not have a UTF-8 locale configured. This causes the test to run and fail.

I patched the interpreter path in the test and enabled UTF-8 support, so the test is not skipped for any Python version. I also added lsof as a checkInput, which allows another test to run.

@lopsided98 lopsided98 changed the title pythonPackages.sh: disable tests on Python 3.7 pythonPackages.sh: fix tests on Python 3.7 Dec 21, 2018
@Mic92
Copy link
Member

Mic92 commented Dec 21, 2018

@GrahamcOfBorg build gitless python27Packages.bitbucket_api python27Packages.python-packer python27Packages.sh python37Packages.python-packer python37Packages.sh

@Mic92
Copy link
Member

Mic92 commented Dec 21, 2018

I wonder if osx is not detected correctly: https://github.com/amoffat/sh/blob/master/test.py#L61

@Mic92
Copy link
Member

Mic92 commented Dec 21, 2018

Ah, they probably test with a different ls, in nixpkgs we use coreutils also for macOS. I would say either do not run those tests or disable checkPhase on macOS.

@lopsided98
Copy link
Contributor Author

I added a patch that skips the failing tests on macOS.

@Mic92 Mic92 merged commit 907e88c into NixOS:master Dec 22, 2018
@lopsided98 lopsided98 deleted the python-sh-disable-tests branch December 22, 2018 18:32
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