Skip to content

Commit

Permalink
Update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Nov 13, 2020
1 parent 1520b8e commit 02d3ec9
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions repo_helper/files/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ class TestsRequirementsManager(RequirementsManager):
Requirement("pytest-randomly>=3.3.1"),
Requirement("pytest-timeout>=1.4.2"), # Requirement("pytest-rerunfailures>=9.0"),
Requirement("iniconfig!=1.1.0,>=1.0.1"),
Requirement("domdf-python-tools[testing]>=1.5.0"),
}

def __init__(self, repo_path: PathLike, templates: jinja2.Environment):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jinja2>=2.11.2
packaging>=20.4
pre-commit>=2.7.1
ruamel-yaml>=0.16.12
shippinglabel>=0.1.0
shippinglabel>=0.3.1
southwark>=0.4.0
tomlkit>=0.7.0
typing-extensions>=3.7.4.3
Expand Down
25 changes: 25 additions & 0 deletions tests/test_files/test_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def test_ensure_tests_requirements(tmp_pathplus, demo_environment):
) == """\
coverage>=5.1
coverage-pyver-pragma>=0.0.6
domdf-python-tools[testing]>=1.5.0
iniconfig!=1.1.0,>=1.0.1
pytest>=6.0.0
pytest-cov>=2.8.1
Expand All @@ -164,6 +165,7 @@ def test_ensure_tests_requirements(tmp_pathplus, demo_environment):
) == """\
coverage>=5.1
coverage-pyver-pragma>=0.0.6
domdf-python-tools[testing]>=1.5.0
iniconfig!=1.1.0,>=1.0.1
lorem>=0.1.1
pytest>=6.0.0
Expand All @@ -173,6 +175,29 @@ def test_ensure_tests_requirements(tmp_pathplus, demo_environment):
"""


def test_ensure_tests_requirements_extras(tmp_pathplus, demo_environment):
(tmp_pathplus / "requirements.txt").write_text('domdf_python_tools>=1.5.0')
(tmp_pathplus / "tests").mkdir()
(tmp_pathplus / "tests" / "requirements.txt").write_text('some_package[extra]>=1.5.0')

managed_files = ensure_tests_requirements(tmp_pathplus, demo_environment)
assert managed_files == [posixpath.join("tests", "requirements.txt")]

assert (tmp_pathplus / managed_files[0]).read_text(
encoding="UTF-8"
) == """\
coverage>=5.1
coverage-pyver-pragma>=0.0.6
domdf-python-tools[testing]>=1.5.0
iniconfig!=1.1.0,>=1.0.1
pytest>=6.0.0
pytest-cov>=2.8.1
pytest-randomly>=3.3.1
pytest-timeout>=1.4.2
some-package[extra]>=1.5.0
"""


def test_make_pre_commit(tmp_pathplus, demo_environment, file_regression):
# TODO: permutations to cover all branches
demo_environment.globals["yapf_exclude"] = []
Expand Down
1 change: 1 addition & 0 deletions tests/test_files/test_testing_/test_make_isort_case_1.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ known_third_party =
black
coverage
coverage-pyver-pragma
domdf-python-tools
github
isort
pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_files/test_testing_/test_make_isort_case_2.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ known_third_party =
black
coverage
coverage-pyver-pragma
domdf-python-tools
github
isort
pytest
Expand Down

0 comments on commit 02d3ec9

Please sign in to comment.