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

Skipping Python package tests? #229

Open
denizdogan opened this issue Oct 11, 2022 · 0 comments
Open

Skipping Python package tests? #229

denizdogan opened this issue Oct 11, 2022 · 0 comments

Comments

@denizdogan
Copy link

I've just started out using this for some internal projects, but I've hit a roadblock that I can't figure out.

One of our Python projects uses Poetry for dependency management, and when I'm trying to install it, some Poetry tests fail due to some strange but common issues that urllib has related to macOS and proxies. A piece of the log has been attached below, mainly for googleability.

I've searched far and wide for solutions to this issue, and many suggest setting the environment variable OBJC_DISABLE_INITIALIZE_FORK_SAFETY to YES. This doesn't seem to work for me, for some reason. I use a Macbook Pro with M1/Apple Silicon.

In a different project that doesn't use numtide/devshell, I am able to skip the Poetry build tests using this as my shell.nix file:

with import <nixpkgs> { };
let
  # util to disable tests during python package installation
  skip-setup-tests = drv: drv.overridePythonAttrs (old: { doCheck = false; });
in
mkShell {
  packages = [
    # build requirements for pscyopg2
    postgresql
    openssl

    # python + poetry
    (python39.withPackages (ps: with ps; [
      # skip testing poetry since it's a bit problematic on macOS:
      # https://stackoverflow.com/a/52230415
      (skip-setup-tests poetry)
    ]))
  ];

  shellHook = ''
    export DJANGO_SETTINGS_MODULE=[...]
    [...etc...]
  '';
}

However, I haven't been able to figure out how to do this using numtide/devshell. Is there any easy way?

Current thread 0x0000000100634580 (most recent call first):
  File "/nix/store/rxp6p62b0zlbzann51p3qf0vkkfl89g6-python3-3.9.14/lib/python3.9/urllib/request.py", line 2623 in proxy_bypass_macosx_sysconf
  File "/nix/store/rxp6p62b0zlbzann51p3qf0vkkfl89g6-python3-3.9.14/lib/python3.9/urllib/request.py", line 2647 in proxy_bypass
  File "/nix/store/kc0f8iz24rw3iq35hvvlg72axbclwjyd-python3.9-requests-2.28.1/lib/python3.9/site-packages/requests/utils.py", line 809 in should_bypass_proxies
  File "/nix/store/kc0f8iz24rw3iq35hvvlg72axbclwjyd-python3.9-requests-2.28.1/lib/python3.9/site-packages/requests/utils.py", line 825 in get_environ_proxies
  File "/nix/store/kc0f8iz24rw3iq35hvvlg72axbclwjyd-python3.9-requests-2.28.1/lib/python3.9/site-packages/requests/sessions.py", line 759 in merge_environment_settings
  File "/nix/store/9vshllxw9bw28pdak0n4l8qmm4vygqgs-python3.9-poetry-1.2.0/lib/python3.9/site-packages/poetry/utils/authenticator.py", line 209 in request
  File "/private/tmp/nix-build-python3.9-poetry-1.2.0.drv-2/source/tests/utils/test_authenticator.py", line 90 in test_authenticator_uses_username_only_credentials

If it should matter, my network settings don't have any proxies of any kind configured.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant