|
2 | 2 | import tarfile
|
3 | 3 | from glob import glob
|
4 | 4 | from pathlib import Path
|
| 5 | +from unittest.mock import patch |
5 | 6 |
|
6 | 7 | import nox
|
7 | 8 |
|
@@ -35,3 +36,40 @@ def mypy(session: nox.Session):
|
35 | 36 | def test(session: nox.Session):
|
36 | 37 | session.install("pytest", ".")
|
37 | 38 | session.run("pytest", "setuptools_rust", "tests", *session.posargs)
|
| 39 | + |
| 40 | + |
| 41 | +@nox.session(name="test-mingw") |
| 42 | +def test_mingw(session: nox.Session): |
| 43 | + # manually re-implemented test-examples to workaround |
| 44 | + # https://github.com/wntrblm/nox/issues/630 |
| 45 | + |
| 46 | + oldrun = nox.command.run |
| 47 | + |
| 48 | + def newrun(*args, **kwargs): |
| 49 | + # suppress "external" error on install |
| 50 | + kwargs["external"] = True |
| 51 | + oldrun(*args, **kwargs) |
| 52 | + |
| 53 | + def chdir(path: Path): |
| 54 | + print(path) |
| 55 | + os.chdir(path) |
| 56 | + |
| 57 | + examples = Path(os.path.dirname(__file__)).absolute() / "examples" |
| 58 | + |
| 59 | + with patch.object(nox.command, "run", newrun): |
| 60 | + session.install(".") |
| 61 | + |
| 62 | + session.install("--no-build-isolation", str(examples / "hello-world")) |
| 63 | + session.run("hello-world") |
| 64 | + |
| 65 | + session.install("pytest", "pytest-benchmark", "beautifulsoup4") |
| 66 | + session.install("--no-build-isolation", str(examples / "html-py-ever")) |
| 67 | + session.run("pytest", str(examples / "html-py-ever")) |
| 68 | + |
| 69 | + session.install("pytest") |
| 70 | + session.install("--no-build-isolation", str(examples / "html-py-ever")) |
| 71 | + session.run("pytest", str(examples / "html-py-ever")) |
| 72 | + |
| 73 | + session.install("pytest", "cffi") |
| 74 | + session.install("--no-build-isolation", str(examples / "html-py-ever")) |
| 75 | + session.run("pytest", str(examples / "html-py-ever")) |
0 commit comments