Example #1
0
def test_make_formate_toml_case_1(
    tmp_pathplus: PathPlus,
    demo_environment,
    advanced_file_regression: AdvancedFileRegressionFixture,
):
    (tmp_pathplus / "tests").mkdir()
    (tmp_pathplus / "tests" / "requirements.txt").write_text('')

    (tmp_pathplus / "requirements.txt").write_lines([
        "tox",
        "isort",
        "black",
        "wheel",
        "setuptools_rust",
    ])
    ensure_tests_requirements(tmp_pathplus, demo_environment)

    managed_files = make_formate_toml(tmp_pathplus, demo_environment)
    assert managed_files == ["formate.toml", ".isort.cfg"]
    advanced_file_regression.check_file(tmp_pathplus / managed_files[0])
    assert not (tmp_pathplus / managed_files[1]).is_file()
Example #2
0
def test_ensure_tests_requirements(tmp_pathplus, demo_environment):
    (tmp_pathplus / "requirements.txt").touch()
    (tmp_pathplus / "tests").mkdir()
    (tmp_pathplus / "tests" / "requirements.txt").write_text('')

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

    assert (tmp_pathplus / managed_files[0]).read_lines() == [
        "coincidence>=0.2.0",
        "coverage>=5.1",
        "coverage-pyver-pragma>=0.2.1",
        "importlib-metadata>=3.6.0",
        "pytest>=6.0.0",
        "pytest-cov>=2.8.1",
        "pytest-randomly>=3.7.0",
        "pytest-timeout>=1.4.2",
        '',
    ]

    with (tmp_pathplus / managed_files[0]).open('a') as fp:
        fp.write("lorem>=0.1.1")

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

    assert (tmp_pathplus / managed_files[0]).read_lines() == [
        "coincidence>=0.2.0",
        "coverage>=5.1",
        "coverage-pyver-pragma>=0.2.1",
        "importlib-metadata>=3.6.0",
        "lorem>=0.1.1",
        "pytest>=6.0.0",
        "pytest-cov>=2.8.1",
        "pytest-randomly>=3.7.0",
        "pytest-timeout>=1.4.2",
        '',
    ]
Example #3
0
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_lines() == [
        "coincidence>=0.2.0",
        "coverage>=5.1",
        "coverage-pyver-pragma>=0.2.1",
        "importlib-metadata>=3.6.0",
        "pytest>=6.0.0",
        "pytest-cov>=2.8.1",
        "pytest-randomly>=3.7.0",
        "pytest-timeout>=1.4.2",
        "some-package[extra]>=1.5.0",
        '',
    ]