From eaa882f3d5340956beb176aa1753e07e3f3f2190 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Sat, 26 May 2018 09:05:41 +0200 Subject: [PATCH] switch to src layout --- .gitignore | 2 +- changelog/3513.trivial.rst | 1 + setup.py | 12 ++++++++---- {_pytest => src/_pytest}/__init__.py | 0 {_pytest => src/_pytest}/_argcomplete.py | 0 {_pytest => src/_pytest}/_code/__init__.py | 0 {_pytest => src/_pytest}/_code/_py2traceback.py | 0 {_pytest => src/_pytest}/_code/code.py | 0 {_pytest => src/_pytest}/_code/source.py | 0 {_pytest => src/_pytest}/assertion/__init__.py | 0 {_pytest => src/_pytest}/assertion/rewrite.py | 0 {_pytest => src/_pytest}/assertion/truncate.py | 0 {_pytest => src/_pytest}/assertion/util.py | 0 {_pytest => src/_pytest}/cacheprovider.py | 0 {_pytest => src/_pytest}/capture.py | 0 {_pytest => src/_pytest}/compat.py | 0 {_pytest => src/_pytest}/config.py | 0 {_pytest => src/_pytest}/debugging.py | 0 {_pytest => src/_pytest}/deprecated.py | 0 {_pytest => src/_pytest}/doctest.py | 0 {_pytest => src/_pytest}/fixtures.py | 0 {_pytest => src/_pytest}/freeze_support.py | 0 {_pytest => src/_pytest}/helpconfig.py | 0 {_pytest => src/_pytest}/hookspec.py | 0 {_pytest => src/_pytest}/junitxml.py | 0 {_pytest => src/_pytest}/logging.py | 0 {_pytest => src/_pytest}/main.py | 0 {_pytest => src/_pytest}/mark/__init__.py | 0 {_pytest => src/_pytest}/mark/evaluate.py | 0 {_pytest => src/_pytest}/mark/legacy.py | 0 {_pytest => src/_pytest}/mark/structures.py | 0 {_pytest => src/_pytest}/monkeypatch.py | 0 {_pytest => src/_pytest}/nodes.py | 0 {_pytest => src/_pytest}/nose.py | 0 {_pytest => src/_pytest}/outcomes.py | 0 {_pytest => src/_pytest}/pastebin.py | 0 {_pytest => src/_pytest}/pytester.py | 0 {_pytest => src/_pytest}/python.py | 0 {_pytest => src/_pytest}/python_api.py | 0 {_pytest => src/_pytest}/recwarn.py | 0 {_pytest => src/_pytest}/resultlog.py | 0 {_pytest => src/_pytest}/runner.py | 0 {_pytest => src/_pytest}/setuponly.py | 0 {_pytest => src/_pytest}/setupplan.py | 0 {_pytest => src/_pytest}/skipping.py | 0 {_pytest => src/_pytest}/terminal.py | 0 {_pytest => src/_pytest}/tmpdir.py | 0 {_pytest => src/_pytest}/unittest.py | 0 {_pytest => src/_pytest}/warnings.py | 0 pytest.py => src/pytest.py | 0 50 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 changelog/3513.trivial.rst rename {_pytest => src/_pytest}/__init__.py (100%) rename {_pytest => src/_pytest}/_argcomplete.py (100%) rename {_pytest => src/_pytest}/_code/__init__.py (100%) rename {_pytest => src/_pytest}/_code/_py2traceback.py (100%) rename {_pytest => src/_pytest}/_code/code.py (100%) rename {_pytest => src/_pytest}/_code/source.py (100%) rename {_pytest => src/_pytest}/assertion/__init__.py (100%) rename {_pytest => src/_pytest}/assertion/rewrite.py (100%) rename {_pytest => src/_pytest}/assertion/truncate.py (100%) rename {_pytest => src/_pytest}/assertion/util.py (100%) rename {_pytest => src/_pytest}/cacheprovider.py (100%) rename {_pytest => src/_pytest}/capture.py (100%) rename {_pytest => src/_pytest}/compat.py (100%) rename {_pytest => src/_pytest}/config.py (100%) rename {_pytest => src/_pytest}/debugging.py (100%) rename {_pytest => src/_pytest}/deprecated.py (100%) rename {_pytest => src/_pytest}/doctest.py (100%) rename {_pytest => src/_pytest}/fixtures.py (100%) rename {_pytest => src/_pytest}/freeze_support.py (100%) rename {_pytest => src/_pytest}/helpconfig.py (100%) rename {_pytest => src/_pytest}/hookspec.py (100%) rename {_pytest => src/_pytest}/junitxml.py (100%) rename {_pytest => src/_pytest}/logging.py (100%) rename {_pytest => src/_pytest}/main.py (100%) rename {_pytest => src/_pytest}/mark/__init__.py (100%) rename {_pytest => src/_pytest}/mark/evaluate.py (100%) rename {_pytest => src/_pytest}/mark/legacy.py (100%) rename {_pytest => src/_pytest}/mark/structures.py (100%) rename {_pytest => src/_pytest}/monkeypatch.py (100%) rename {_pytest => src/_pytest}/nodes.py (100%) rename {_pytest => src/_pytest}/nose.py (100%) rename {_pytest => src/_pytest}/outcomes.py (100%) rename {_pytest => src/_pytest}/pastebin.py (100%) rename {_pytest => src/_pytest}/pytester.py (100%) rename {_pytest => src/_pytest}/python.py (100%) rename {_pytest => src/_pytest}/python_api.py (100%) rename {_pytest => src/_pytest}/recwarn.py (100%) rename {_pytest => src/_pytest}/resultlog.py (100%) rename {_pytest => src/_pytest}/runner.py (100%) rename {_pytest => src/_pytest}/setuponly.py (100%) rename {_pytest => src/_pytest}/setupplan.py (100%) rename {_pytest => src/_pytest}/skipping.py (100%) rename {_pytest => src/_pytest}/terminal.py (100%) rename {_pytest => src/_pytest}/tmpdir.py (100%) rename {_pytest => src/_pytest}/unittest.py (100%) rename {_pytest => src/_pytest}/warnings.py (100%) rename pytest.py => src/pytest.py (100%) diff --git a/.gitignore b/.gitignore index 99c4c7bad..afb6bf9fd 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 000000000..e8c0948e0 --- /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 1e67f27f0..3f5ed39be 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 @@ class PyTest(Command): 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