diff --git a/.gitignore b/.gitignore index 99c4c7badb2..afb6bf9fd3f 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ include/ .hypothesis/ # autogenerated -_pytest/_version.py +src/_pytest/_version.py # setuptools .eggs/ diff --git a/changelog/3513.trivial.rst b/changelog/3513.trivial.rst new file mode 100644 index 00000000000..e8c0948e0b7 --- /dev/null +++ b/changelog/3513.trivial.rst @@ -0,0 +1 @@ +Switch pytest to the src/ layout as we already suggested it for good practice - now we implement it as well. diff --git a/setup.py b/setup.py index 1e67f27f08c..3f5ed39beac 100644 --- a/setup.py +++ b/setup.py @@ -50,6 +50,9 @@ def get_environment_marker_support_level(): return 1 except Exception as exc: sys.stderr.write("Could not test setuptool's version: %s\n" % exc) + + # as of testing on 2018-05-26 fedora was on version 37* and debian was on version 33+ + # we should consider erroring on those return 0 @@ -84,7 +87,7 @@ def main(): name="pytest", description="pytest: simple powerful testing with Python", long_description=long_description, - use_scm_version={"write_to": "_pytest/_version.py"}, + use_scm_version={"write_to": "src/_pytest/_version.py"}, url="http://pytest.org", project_urls={ "Source": "https://github.com/pytest-dev/pytest", @@ -102,6 +105,7 @@ def main(): cmdclass={"test": PyTest}, # the following should be enabled for release setup_requires=["setuptools-scm"], + package_dir={"": "src"}, python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", install_requires=install_requires, extras_require=extras_require, @@ -123,9 +127,9 @@ def finalize_options(self): def run(self): import subprocess - PPATH = [x for x in os.environ.get("PYTHONPATH", "").split(":") if x] - PPATH.insert(0, os.getcwd()) - os.environ["PYTHONPATH"] = ":".join(PPATH) + python_path = [x for x in os.environ.get("PYTHONPATH", "").split(":") if x] + python_path.insert(0, os.getcwd()) + os.environ["PYTHONPATH"] = ":".join(python_path) errno = subprocess.call([sys.executable, "pytest.py", "--ignore=doc"]) raise SystemExit(errno) diff --git a/_pytest/__init__.py b/src/_pytest/__init__.py similarity index 100% rename from _pytest/__init__.py rename to src/_pytest/__init__.py diff --git a/_pytest/_argcomplete.py b/src/_pytest/_argcomplete.py similarity index 100% rename from _pytest/_argcomplete.py rename to src/_pytest/_argcomplete.py diff --git a/_pytest/_code/__init__.py b/src/_pytest/_code/__init__.py similarity index 100% rename from _pytest/_code/__init__.py rename to src/_pytest/_code/__init__.py diff --git a/_pytest/_code/_py2traceback.py b/src/_pytest/_code/_py2traceback.py similarity index 100% rename from _pytest/_code/_py2traceback.py rename to src/_pytest/_code/_py2traceback.py diff --git a/_pytest/_code/code.py b/src/_pytest/_code/code.py similarity index 100% rename from _pytest/_code/code.py rename to src/_pytest/_code/code.py diff --git a/_pytest/_code/source.py b/src/_pytest/_code/source.py similarity index 100% rename from _pytest/_code/source.py rename to src/_pytest/_code/source.py diff --git a/_pytest/assertion/__init__.py b/src/_pytest/assertion/__init__.py similarity index 100% rename from _pytest/assertion/__init__.py rename to src/_pytest/assertion/__init__.py diff --git a/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py similarity index 100% rename from _pytest/assertion/rewrite.py rename to src/_pytest/assertion/rewrite.py diff --git a/_pytest/assertion/truncate.py b/src/_pytest/assertion/truncate.py similarity index 100% rename from _pytest/assertion/truncate.py rename to src/_pytest/assertion/truncate.py diff --git a/_pytest/assertion/util.py b/src/_pytest/assertion/util.py similarity index 100% rename from _pytest/assertion/util.py rename to src/_pytest/assertion/util.py diff --git a/_pytest/cacheprovider.py b/src/_pytest/cacheprovider.py similarity index 100% rename from _pytest/cacheprovider.py rename to src/_pytest/cacheprovider.py diff --git a/_pytest/capture.py b/src/_pytest/capture.py similarity index 100% rename from _pytest/capture.py rename to src/_pytest/capture.py diff --git a/_pytest/compat.py b/src/_pytest/compat.py similarity index 100% rename from _pytest/compat.py rename to src/_pytest/compat.py diff --git a/_pytest/config.py b/src/_pytest/config.py similarity index 100% rename from _pytest/config.py rename to src/_pytest/config.py diff --git a/_pytest/debugging.py b/src/_pytest/debugging.py similarity index 100% rename from _pytest/debugging.py rename to src/_pytest/debugging.py diff --git a/_pytest/deprecated.py b/src/_pytest/deprecated.py similarity index 100% rename from _pytest/deprecated.py rename to src/_pytest/deprecated.py diff --git a/_pytest/doctest.py b/src/_pytest/doctest.py similarity index 100% rename from _pytest/doctest.py rename to src/_pytest/doctest.py diff --git a/_pytest/fixtures.py b/src/_pytest/fixtures.py similarity index 100% rename from _pytest/fixtures.py rename to src/_pytest/fixtures.py diff --git a/_pytest/freeze_support.py b/src/_pytest/freeze_support.py similarity index 100% rename from _pytest/freeze_support.py rename to src/_pytest/freeze_support.py diff --git a/_pytest/helpconfig.py b/src/_pytest/helpconfig.py similarity index 100% rename from _pytest/helpconfig.py rename to src/_pytest/helpconfig.py diff --git a/_pytest/hookspec.py b/src/_pytest/hookspec.py similarity index 100% rename from _pytest/hookspec.py rename to src/_pytest/hookspec.py diff --git a/_pytest/junitxml.py b/src/_pytest/junitxml.py similarity index 100% rename from _pytest/junitxml.py rename to src/_pytest/junitxml.py diff --git a/_pytest/logging.py b/src/_pytest/logging.py similarity index 100% rename from _pytest/logging.py rename to src/_pytest/logging.py diff --git a/_pytest/main.py b/src/_pytest/main.py similarity index 100% rename from _pytest/main.py rename to src/_pytest/main.py diff --git a/_pytest/mark/__init__.py b/src/_pytest/mark/__init__.py similarity index 100% rename from _pytest/mark/__init__.py rename to src/_pytest/mark/__init__.py diff --git a/_pytest/mark/evaluate.py b/src/_pytest/mark/evaluate.py similarity index 100% rename from _pytest/mark/evaluate.py rename to src/_pytest/mark/evaluate.py diff --git a/_pytest/mark/legacy.py b/src/_pytest/mark/legacy.py similarity index 100% rename from _pytest/mark/legacy.py rename to src/_pytest/mark/legacy.py diff --git a/_pytest/mark/structures.py b/src/_pytest/mark/structures.py similarity index 100% rename from _pytest/mark/structures.py rename to src/_pytest/mark/structures.py diff --git a/_pytest/monkeypatch.py b/src/_pytest/monkeypatch.py similarity index 100% rename from _pytest/monkeypatch.py rename to src/_pytest/monkeypatch.py diff --git a/_pytest/nodes.py b/src/_pytest/nodes.py similarity index 100% rename from _pytest/nodes.py rename to src/_pytest/nodes.py diff --git a/_pytest/nose.py b/src/_pytest/nose.py similarity index 100% rename from _pytest/nose.py rename to src/_pytest/nose.py diff --git a/_pytest/outcomes.py b/src/_pytest/outcomes.py similarity index 100% rename from _pytest/outcomes.py rename to src/_pytest/outcomes.py diff --git a/_pytest/pastebin.py b/src/_pytest/pastebin.py similarity index 100% rename from _pytest/pastebin.py rename to src/_pytest/pastebin.py diff --git a/_pytest/pytester.py b/src/_pytest/pytester.py similarity index 100% rename from _pytest/pytester.py rename to src/_pytest/pytester.py diff --git a/_pytest/python.py b/src/_pytest/python.py similarity index 100% rename from _pytest/python.py rename to src/_pytest/python.py diff --git a/_pytest/python_api.py b/src/_pytest/python_api.py similarity index 100% rename from _pytest/python_api.py rename to src/_pytest/python_api.py diff --git a/_pytest/recwarn.py b/src/_pytest/recwarn.py similarity index 100% rename from _pytest/recwarn.py rename to src/_pytest/recwarn.py diff --git a/_pytest/resultlog.py b/src/_pytest/resultlog.py similarity index 100% rename from _pytest/resultlog.py rename to src/_pytest/resultlog.py diff --git a/_pytest/runner.py b/src/_pytest/runner.py similarity index 100% rename from _pytest/runner.py rename to src/_pytest/runner.py diff --git a/_pytest/setuponly.py b/src/_pytest/setuponly.py similarity index 100% rename from _pytest/setuponly.py rename to src/_pytest/setuponly.py diff --git a/_pytest/setupplan.py b/src/_pytest/setupplan.py similarity index 100% rename from _pytest/setupplan.py rename to src/_pytest/setupplan.py diff --git a/_pytest/skipping.py b/src/_pytest/skipping.py similarity index 100% rename from _pytest/skipping.py rename to src/_pytest/skipping.py diff --git a/_pytest/terminal.py b/src/_pytest/terminal.py similarity index 100% rename from _pytest/terminal.py rename to src/_pytest/terminal.py diff --git a/_pytest/tmpdir.py b/src/_pytest/tmpdir.py similarity index 100% rename from _pytest/tmpdir.py rename to src/_pytest/tmpdir.py diff --git a/_pytest/unittest.py b/src/_pytest/unittest.py similarity index 100% rename from _pytest/unittest.py rename to src/_pytest/unittest.py diff --git a/_pytest/warnings.py b/src/_pytest/warnings.py similarity index 100% rename from _pytest/warnings.py rename to src/_pytest/warnings.py diff --git a/pytest.py b/src/pytest.py similarity index 100% rename from pytest.py rename to src/pytest.py