Skip to content

Commit

Permalink
Add --nox, export before tests
Browse files Browse the repository at this point in the history
  • Loading branch information
object-Object committed Nov 5, 2023
1 parent 257a80a commit d54092b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
18 changes: 9 additions & 9 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@


@nox.session
def lint(session: nox.Session):
def tests(session: nox.Session):
session.install("favicons") # TODO: remove
session.install(".[test]", "nox", "pyright")
session.install("pyright", "nox")
session.install("-e", ".[test]", "-e", "./test/_submodules/HexMod")

session.run("pyright", "--warnings")


@nox.session
def tests(session: nox.Session):
session.install("favicons") # TODO: remove
session.install(".[test]", "./test/_submodules/HexMod")
session.run("hexdoc", "export", "--props", "properties.toml")
session.run(
"hexdoc", "export", "--props", "test/_submodules/HexMod/doc/properties.toml"
)

# test cookiecutter last so the extra package install doesn't interfere
session.run("pytest", "-k", "not test_cookiecutter")
session.run("pytest", "-k", "test_cookiecutter")
session.run("pytest", *session.posargs)
session.run("pytest", "-k", "test_cookiecutter", "--nox", *session.posargs)
2 changes: 1 addition & 1 deletion test/_submodules/HexMod
7 changes: 7 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from hexdoc.plugin import PluginManager

longrun = pytest.mark.skipif("not config.getoption('longrun')")
nox_only = pytest.mark.skipif("not config.getoption('nox')")


# https://stackoverflow.com/a/43938191
Expand All @@ -20,6 +21,12 @@ def pytest_addoption(parser: Parser):
dest="longrun",
help="disable longrun-decorated tests",
)
parser.addoption(
"--nox",
action="store_true",
dest="nox",
help="enable nox_only-decorated tests",
)


class FilePathSnapshotExtension(SingleFileSnapshotExtension):
Expand Down
4 changes: 2 additions & 2 deletions test/test_cookiecutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

from hexdoc._cli.app import render

from .conftest import longrun
from .conftest import nox_only


@longrun
@nox_only
def test_cookiecutter(cookies: Cookies, monkeypatch: MonkeyPatch):
result = cookies.bake(
{
Expand Down

0 comments on commit d54092b

Please sign in to comment.