Beispiel #1
0
def test_is_setup_py_different_encoding(tmpdir, mod):
    setup_py = tmpdir.join("setup.py")
    contents = ("# -*- coding: cp1252 -*-\n"
                'from {} import setup; setup(name="foo", description="€")\n'.
                format(mod))
    setup_py.write_binary(contents.encode("cp1252"))
    assert _is_setup_py(setup_py)
Beispiel #2
0
def test_is_setup_py_different_encoding(tmp_path: Path, mod: str) -> None:
    setup_py = tmp_path.joinpath("setup.py")
    contents = ("# -*- coding: cp1252 -*-\n"
                'from {} import setup; setup(name="foo", description="€")\n'.
                format(mod))
    setup_py.write_bytes(contents.encode("cp1252"))
    assert _is_setup_py(setup_py)
Beispiel #3
0
def test_is_setup_py_is_a_setup_py(tmp_path: Path, mod: str) -> None:
    setup_py = tmp_path.joinpath("setup.py")
    setup_py.write_text(f'from {mod} import setup; setup(name="foo")', "utf-8")
    assert _is_setup_py(setup_py)
Beispiel #4
0
def test_is_setup_py_not_named_setup_py(tmp_path: Path) -> None:
    not_setup_py = tmp_path.joinpath("not_setup.py")
    not_setup_py.write_text('from setuptools import setup; setup(name="foo")')
    assert not _is_setup_py(not_setup_py)
Beispiel #5
0
def test_is_setup_py_is_a_setup_py(tmpdir, mod):
    setup_py = tmpdir.join("setup.py")
    setup_py.write('from {} import setup; setup(name="foo")'.format(mod))
    assert _is_setup_py(setup_py)
Beispiel #6
0
def test_is_setup_py_not_named_setup_py(tmpdir):
    not_setup_py = tmpdir.join("not_setup.py")
    not_setup_py.write('from setuptools import setup; setup(name="foo")')
    assert not _is_setup_py(not_setup_py)
Beispiel #7
0
def test_is_setup_py_is_a_setup_py(tmpdir, mod):
    setup_py = tmpdir.join("setup.py")
    setup_py.write(f'from {mod} import setup; setup(name="foo")')
    assert _is_setup_py(setup_py)
Beispiel #8
0
def test_is_setup_py_not_named_setup_py(tmp_path):
    not_setup_py = tmp_path.joinpath("not_setup.py")
    not_setup_py.write_text('from setuptools import setup; setup(name="foo")')
    assert not _is_setup_py(py.path.local(str(not_setup_py)))
Beispiel #9
0
def pytest_collect_file(path, parent):
    config = parent.config
    if path.ext == ".py":
        if config.option.doctestmodules and not _is_setup_py(
                config, path, parent):
            return DoctestModule(path, parent)