[Top][All Lists]

[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

(define-public python-virtualenv-clone
    (name "python-virtualenv-clone")
    (version "0.5.6")
        (method git-fetch)
         (git-reference (url "";)
                        (commit version)))
     `(("python-pytest" ,python-pytest)
       ("python-tox" ,python-tox)
       ("python-virtualenv" ,python-virtualenv)))
    (build-system python-build-system)
       (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 =
                        (("(commands = py.test -v) \\[\\]" _ cmd)
                         (string-append cmd " tests")))
    (synopsis "script to clone virtualenvs.")
    (description "script to clone virtualenvs.")
    (license license:expat)))

reply via email to

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