diff --git a/.gitignore b/.gitignore
index c2d2a72090e..fcbd92e97a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,6 @@
*.egg
!/tests/**/*.egg
/*.egg-info
-/tests/fixtures/**/*.egg-info
/dist/*
build
_build
diff --git a/poetry/puzzle/provider.py b/poetry/puzzle/provider.py
index 989a592912b..4888b9828b1 100644
--- a/poetry/puzzle/provider.py
+++ b/poetry/puzzle/provider.py
@@ -326,10 +326,7 @@ def get_package_from_directory(
os.chdir(str(directory))
try:
- with temporary_directory() as tmp_dir:
- EnvManager.build_venv(tmp_dir)
- venv = VirtualEnv(Path(tmp_dir), Path(tmp_dir))
- venv.run("python", "setup.py", "egg_info")
+ cls._execute_setup()
except EnvCommandError:
result = SetupReader.read_from_directory(directory)
if not result["name"]:
@@ -817,3 +814,9 @@ def progress(self):
yield
self._in_progress = False
+
+ def _execute_setup(self):
+ with temporary_directory() as tmp_dir:
+ EnvManager.build_venv(tmp_dir)
+ venv = VirtualEnv(Path(tmp_dir), Path(tmp_dir))
+ venv.run("python", "setup.py", "egg_info")
diff --git a/pyproject.toml b/pyproject.toml
index 938b89fe422..519fb373ca6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -116,3 +116,23 @@ known_third_party = [
"shellingham",
"tomlkit",
]
+
+
+[tool.black]
+line-length = 88
+include = '\.pyi?$'
+exclude = '''
+/(
+ \.eggs
+ | \.git
+ | \.hg
+ | \.mypy_cache
+ | \.tox
+ | \.venv
+ | _build
+ | buck-out
+ | build
+ | dist
+ | tests/.*/setup.py
+)/
+'''
diff --git a/tests/conftest.py b/tests/conftest.py
index d5ff7f488c9..8386ad35f57 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -74,6 +74,11 @@ def download_mock(mocker):
mocker.patch("poetry.utils.inspector.Inspector.download", new=mock_download)
+@pytest.fixture(autouse=True)
+def execute_setup_mock(mocker):
+ mocker.patch("poetry.puzzle.provider.Provider._execute_setup")
+
+
@pytest.fixture
def environ():
original_environ = dict(os.environ)
diff --git a/tests/fixtures/git/github.com/demo/demo/demo.egg-info/PKG-INFO b/tests/fixtures/git/github.com/demo/demo/demo.egg-info/PKG-INFO
new file mode 100755
index 00000000000..7f543c49cb3
--- /dev/null
+++ b/tests/fixtures/git/github.com/demo/demo/demo.egg-info/PKG-INFO
@@ -0,0 +1,12 @@
+Metadata-Version: 2.1
+Name: demo
+Version: 0.1.2
+Summary: Demo project.
+Home-page: https://github.com/demo/demo
+Author: Sébastien Eustace
+Author-email: sebastien@eustace.io
+License: MIT
+Description: UNKNOWN
+Platform: UNKNOWN
+Provides-Extra: bar
+Provides-Extra: foo
diff --git a/tests/fixtures/git/github.com/demo/demo/demo.egg-info/SOURCES.txt b/tests/fixtures/git/github.com/demo/demo/demo.egg-info/SOURCES.txt
new file mode 100755
index 00000000000..6eb8a3ef3e3
--- /dev/null
+++ b/tests/fixtures/git/github.com/demo/demo/demo.egg-info/SOURCES.txt
@@ -0,0 +1,7 @@
+setup.py
+demo/__init__.py
+demo.egg-info/PKG-INFO
+demo.egg-info/SOURCES.txt
+demo.egg-info/dependency_links.txt
+demo.egg-info/requires.txt
+demo.egg-info/top_level.txt
diff --git a/tests/fixtures/git/github.com/demo/demo/demo.egg-info/dependency_links.txt b/tests/fixtures/git/github.com/demo/demo/demo.egg-info/dependency_links.txt
new file mode 100755
index 00000000000..e69de29bb2d
diff --git a/tests/fixtures/git/github.com/demo/demo/demo.egg-info/requires.txt b/tests/fixtures/git/github.com/demo/demo/demo.egg-info/requires.txt
new file mode 100755
index 00000000000..e05a65d3c93
--- /dev/null
+++ b/tests/fixtures/git/github.com/demo/demo/demo.egg-info/requires.txt
@@ -0,0 +1,7 @@
+pendulum>=1.4.4
+
+[bar]
+tomlkit
+
+[foo]
+cleo
diff --git a/tests/fixtures/git/github.com/demo/demo/demo.egg-info/top_level.txt b/tests/fixtures/git/github.com/demo/demo/demo.egg-info/top_level.txt
new file mode 100755
index 00000000000..1549b67ca59
--- /dev/null
+++ b/tests/fixtures/git/github.com/demo/demo/demo.egg-info/top_level.txt
@@ -0,0 +1 @@
+demo
diff --git a/tests/fixtures/git/github.com/demo/no-dependencies/demo.egg-info/PKG-INFO b/tests/fixtures/git/github.com/demo/no-dependencies/demo.egg-info/PKG-INFO
new file mode 100644
index 00000000000..7ba97897a10
--- /dev/null
+++ b/tests/fixtures/git/github.com/demo/no-dependencies/demo.egg-info/PKG-INFO
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: demo
+Version: 0.1.2
+Summary: Demo project.
+Home-page: https://github.com/demo/demo
+Author: Sébastien Eustace
+Author-email: sebastien@eustace.io
+License: MIT
+Description: UNKNOWN
+Platform: UNKNOWN
diff --git a/tests/fixtures/git/github.com/demo/no-dependencies/demo.egg-info/SOURCES.txt b/tests/fixtures/git/github.com/demo/no-dependencies/demo.egg-info/SOURCES.txt
new file mode 100644
index 00000000000..e19f4a4eb57
--- /dev/null
+++ b/tests/fixtures/git/github.com/demo/no-dependencies/demo.egg-info/SOURCES.txt
@@ -0,0 +1,6 @@
+setup.py
+demo/__init__.py
+demo.egg-info/PKG-INFO
+demo.egg-info/SOURCES.txt
+demo.egg-info/dependency_links.txt
+demo.egg-info/top_level.txt
diff --git a/tests/fixtures/git/github.com/demo/no-dependencies/demo.egg-info/dependency_links.txt b/tests/fixtures/git/github.com/demo/no-dependencies/demo.egg-info/dependency_links.txt
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/fixtures/git/github.com/demo/no-dependencies/demo.egg-info/top_level.txt b/tests/fixtures/git/github.com/demo/no-dependencies/demo.egg-info/top_level.txt
new file mode 100644
index 00000000000..1549b67ca59
--- /dev/null
+++ b/tests/fixtures/git/github.com/demo/no-dependencies/demo.egg-info/top_level.txt
@@ -0,0 +1 @@
+demo
diff --git a/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/PKG-INFO b/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/PKG-INFO
new file mode 100644
index 00000000000..996589ec257
--- /dev/null
+++ b/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/PKG-INFO
@@ -0,0 +1,12 @@
+Metadata-Version: 2.1
+Name: Demo
+Version: 0.1.2
+Summary: Demo project.
+Home-page: https://github.com/demo/demo
+Author: Sébastien Eustace
+Author-email: sebastien@eustace.io
+License: MIT
+Description: UNKNOWN
+Platform: UNKNOWN
+Provides-Extra: foo
+Provides-Extra: bar
diff --git a/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/SOURCES.txt b/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/SOURCES.txt
new file mode 100644
index 00000000000..8134b008da5
--- /dev/null
+++ b/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/SOURCES.txt
@@ -0,0 +1,7 @@
+setup.py
+Demo.egg-info/PKG-INFO
+Demo.egg-info/SOURCES.txt
+Demo.egg-info/dependency_links.txt
+Demo.egg-info/requires.txt
+Demo.egg-info/top_level.txt
+demo/__init__.py
diff --git a/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/dependency_links.txt b/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/dependency_links.txt
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/requires.txt b/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/requires.txt
new file mode 100644
index 00000000000..e05a65d3c93
--- /dev/null
+++ b/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/requires.txt
@@ -0,0 +1,7 @@
+pendulum>=1.4.4
+
+[bar]
+tomlkit
+
+[foo]
+cleo
diff --git a/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/top_level.txt b/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/top_level.txt
new file mode 100644
index 00000000000..1549b67ca59
--- /dev/null
+++ b/tests/fixtures/git/github.com/demo/non-canonical-name/Demo.egg-info/top_level.txt
@@ -0,0 +1 @@
+demo
diff --git a/tests/fixtures/project_with_setup/my_package.egg-info/PKG-INFO b/tests/fixtures/project_with_setup/my_package.egg-info/PKG-INFO
new file mode 100644
index 00000000000..71ba645751f
--- /dev/null
+++ b/tests/fixtures/project_with_setup/my_package.egg-info/PKG-INFO
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: my-package
+Version: 0.1.2
+Summary: Demo project.
+Home-page: https://github.com/demo/demo
+Author: Sébastien Eustace
+Author-email: sebastien@eustace.io
+License: MIT
+Description: UNKNOWN
+Platform: UNKNOWN
diff --git a/tests/fixtures/project_with_setup/my_package.egg-info/SOURCES.txt b/tests/fixtures/project_with_setup/my_package.egg-info/SOURCES.txt
new file mode 100644
index 00000000000..f5255dc9dad
--- /dev/null
+++ b/tests/fixtures/project_with_setup/my_package.egg-info/SOURCES.txt
@@ -0,0 +1,7 @@
+setup.py
+my_package/__init__.py
+my_package.egg-info/PKG-INFO
+my_package.egg-info/SOURCES.txt
+my_package.egg-info/dependency_links.txt
+my_package.egg-info/requires.txt
+my_package.egg-info/top_level.txt
diff --git a/tests/fixtures/project_with_setup/my_package.egg-info/dependency_links.txt b/tests/fixtures/project_with_setup/my_package.egg-info/dependency_links.txt
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/fixtures/project_with_setup/my_package.egg-info/requires.txt b/tests/fixtures/project_with_setup/my_package.egg-info/requires.txt
new file mode 100644
index 00000000000..eeb0a4815ce
--- /dev/null
+++ b/tests/fixtures/project_with_setup/my_package.egg-info/requires.txt
@@ -0,0 +1,2 @@
+pendulum>=1.4.4
+cachy[msgpack]>=0.2.0
diff --git a/tests/fixtures/project_with_setup/my_package.egg-info/top_level.txt b/tests/fixtures/project_with_setup/my_package.egg-info/top_level.txt
new file mode 100644
index 00000000000..5d04b540bc9
--- /dev/null
+++ b/tests/fixtures/project_with_setup/my_package.egg-info/top_level.txt
@@ -0,0 +1 @@
+my_package
diff --git a/tests/masonry/builders/fixtures/excluded_subpackage/README.rst b/tests/masonry/builders/fixtures/excluded_subpackage/README.rst
index b00640203c5..f7fe15470f9 100644
--- a/tests/masonry/builders/fixtures/excluded_subpackage/README.rst
+++ b/tests/masonry/builders/fixtures/excluded_subpackage/README.rst
@@ -1,2 +1,2 @@
My Package
-==========
\ No newline at end of file
+==========
diff --git a/tests/puzzle/test_provider.py b/tests/puzzle/test_provider.py
index d3bcba65688..4d4463b3b73 100644
--- a/tests/puzzle/test_provider.py
+++ b/tests/puzzle/test_provider.py
@@ -118,7 +118,7 @@ def test_search_for_vcs_read_setup_with_extras(provider, mocker):
def test_search_for_vcs_read_setup_raises_error_if_no_version(provider, mocker):
mocker.patch(
- "poetry.utils.env.VirtualEnv.run",
+ "poetry.puzzle.provider.Provider._execute_setup",
side_effect=EnvCommandError(CalledProcessError(1, "python", output="")),
)
diff --git a/tests/repositories/fixtures/installed/vendor/py3.7/attrs-19.3.0.dist-info/METADATA b/tests/repositories/fixtures/installed/vendor/py3.7/attrs-19.3.0.dist-info/METADATA
index a1064151030..6c8d9f7d6eb 100644
--- a/tests/repositories/fixtures/installed/vendor/py3.7/attrs-19.3.0.dist-info/METADATA
+++ b/tests/repositories/fixtures/installed/vendor/py3.7/attrs-19.3.0.dist-info/METADATA
@@ -225,5 +225,3 @@ A full list of contributors can be found in `GitHub's overview `_ and aspires to fix some of it clunkiness and unfortunate decisions.
Both were inspired by Twisted’s `FancyEqMixin `_ but both are implemented using class decorators because `subclassing is bad for you `_, m’kay?
-
-