help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Python Tox Dependencies Invisible to Pip


From: Antwane Mason
Subject: Re: Python Tox Dependencies Invisible to Pip
Date: Thu, 26 Aug 2021 21:53:49 -0400

It turns out my intuition was right and I needed to prevent tox from
unsetting PYTHONPATH environment variable. The solution was to add a build
phase prior to testing that passes the PYTHONPATH environment variable to
the virtual environments. Unrelated to the problem, I also needed to tell
tox to skip interpreters that are not present on my system and I needed to
adjust the test command to point to the "tests" folder where the unit tests
were stored. Below is the resulting package definition. I'm one step closer
to building python-onlykey package but now having to fight with test
failures while building python-verspec, another transitive dependency of
python-onlykey.

------------------------------------------------
(define-public python-virtualenv-clone
  (package
    (name "python-virtualenv-clone")
    (version "0.5.6")
    (source
      (origin
        (method git-fetch)
        (uri
         (git-reference (url "
https://github.com/edwardgeorge/virtualenv-clone";)
                        (commit version)))
        (sha256
          (base32
            "0xb20fhl99dw5vnyb43sjpj9628nbdnwp5g7m8f2id7w8kpwzvfw"))))
    (native-inputs
     `(("python-pytest" ,python-pytest)
       ("python-tox" ,python-tox)
       ("python-virtualenv" ,python-virtualenv)))
    (build-system python-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'configure-tox
                    (lambda _
                      (substitute* "tox.ini"
                        (("(\\[testenv\\])" section-header)
                          (string-append section-header
                                         "\npassenv = PYTHONPATH"))
                        (("(\\[tox\\])" section-header)
                          (string-append section-header
                                         "\nskip_missing_interpreters =
true"))
                        (("(commands = py.test -v) \\[\\]" _ cmd)
                         (string-append cmd " tests")))
                      #t)))))
    (home-page
     "https://github.com/edwardgeorge/virtualenv-clone";)
    (synopsis "script to clone virtualenvs.")
    (description "script to clone virtualenvs.")
    (license license:expat)))
------------------------------------------------
Regards,
Antwane


reply via email to

[Prev in Thread] Current Thread [Next in Thread]