matrix testing
See original GitHub issueThis library looks like exactly what i’m looking for!
I’ve got a slightly hacky setup trying to test a matrix of both Python versions and versions of specific packages, using Nox and Poetry.
Currently looks like this (i’m still playing with it)
import nox
import tempfile
from pathlib import Path
import os
from distutils.dir_util import copy_tree
python_versions = [
"3.5",
"3.6",
"3.7",
"3.8",
]
sphinx_versions = [
"~2.2",
"~2.3",
"~2.4",
"~3.0",
"~3.2",
]
@nox.session(python=python_versions, reuse_venv=True)
@nox.parametrize("sphinx", sphinx_versions)
def test(session, sphinx):
# see https://github.com/python-poetry/poetry/issues/2920#issuecomment-693147409
with tempfile.TemporaryDirectory() as tmp_dir:
copy_tree(
Path.cwd(), tmp_dir
)
os.chdir(tmp_dir)
session.run('poetry', 'add', f'sphinx@{sphinx}', external=True)
session.run('poetry', 'install', external=True)
session.run('nosetests', '-w', 'tests')
@nox.session(python=None)
def lint(session):
session.run('flake8', 'sphinxcontrib', external=True)
seems to work, but i don’t love it. How would you express this idiomatically using your library?
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Matrix Sciences Secure Log in
Matrix Sciences Secure Log in with. Google Facebook. Or Log in with Username. Forgot Password? English. Français. Login. Don't have an account?
Read more >What is Requirements Traceability Matrix (RTM) in Testing?
Requirement Traceability Matrix (RTM) is a document that maps and traces user requirement with test cases. It captures all requirements ...
Read more >Matrix Sciences: Homepage
We are always by your side, from laboratory testing to risk management solutions to research. You have us at every step from Cultivation...
Read more >What Is A Coverage Matrix? - Inspired Testing
A test matrix is used to capture the actual quality, the effort, the plan, resources and time required to complete all phases of...
Read more >What is Software Testing Traceability Matrix? What are its Types
Traceability matrix or software testing traceability matrix is a document that traces and maps the relationship between two baseline ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
hi @danieleades ,
Thanks for raising this use case! We actually had this conversation before 😉 see https://github.com/theacodes/nox/issues/347
An issue in nox-poetry’s support for parametrized sessions was fixed in 0.8.1, released today. You’ll need to upgrade to get this to work.
Just install your package, then install the desired Sphinx version on top:
(Unfortunately, you cannot simply do
session.install(".", f"sphinx=={sphinx}")
. It seems pip does not let you override constraints files like this.)If you want a less verbose output from the session, you can pass
silent=True
tosession.run
, which is whatsession.install
does by default. However, the pip output may be valuable as you are installing into an already populated virtualenv.Would that work for your use case?
@brechtm
In my experience, Dependabot always updates the version constraint in
pyproject.toml
to require the latest version, even when the existing version constraint includes the new version. AFAIU, Dependabot has support for widening version ranges, but not for Python projects. See https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#versioning-strategyDo you (and @danieleades) see anything additional that nox-poetry could/should do to support this use case?
That seems like it would work perfectly 👍
I also saw that in the GitHub docs, but it does seem to be widening the version range in practice.
No, I think with the information in this thread it should be possible to get this to work.
Of course, it would be great if nox-poetry could include the functionality I discussed above, but that’s of course up to you to decide! Or perhaps you would accept a pull request?
I’ve had a go at implementing the get_versions() function. I’m not sure when I’ll have time to transform this into a proper implementation, so I’ll just leave it here for future reference:
You need to save this code to a file in the same directory as your pyproject.toml or adjust the path passed to
create_poetry()
.With a dependency
sphinx >= 2.2.1
, this returns:get_versions('sphinx', 'major')
: 2.4.4, 3.4.3get_versions('sphinx', 'minor')
: 2.2.2, 2.3.1, 2.4.4, 3.0.4, 3.1.2, 3.2.1, 3.3.1, 3.4.3get_versions('sphinx', 'patch')
: 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.1.0, 3.1.1, 3.1.2, 3.2.0, 3.2.1, 3.3.0, 3.3.1, 3.4.0, 3.4.1, 3.4.2, 3.4.3