[0-9]+(?:\.[0-9]+)*) # release segment
- (?P # pre-release
- [-_.]?
- (?P(a|b|c|rc|alpha|beta|pre|preview))
- [-_.]?
- (?P[0-9]+)?
- )?
- (?P # post release
- (?:-(?P[0-9]+))
- |
- (?:
- [-_.]?
- (?Ppost|rev|r)
- [-_.]?
- (?P[0-9]+)?
- )
- )?
- (?P # dev release
- [-_.]?
- (?Pdev)
- [-_.]?
- (?P[0-9]+)?
- )?
- )
- (?:\+(?P[a-z0-9]+(?:[-_.][a-z0-9]+)*))? # local version
- $
-""",
- re.IGNORECASE | re.VERBOSE,
-)
-
-
-class Version(BaseVersion):
- def __init__(self, version):
- # Validate the version and parse it into pieces
- match = VERSION_PATTERN.match(version)
- if not match:
- raise InvalidVersion("Invalid version: '{0}'".format(version))
-
- # Store the parsed out pieces of the version
- self._version = _Version(
- epoch=int(match.group("epoch")) if match.group("epoch") else 0,
- release=tuple(int(i) for i in match.group("release").split(".")),
- pre=_parse_letter_version(match.group("pre_l"), match.group("pre_n")),
- post=_parse_letter_version(
- match.group("post_l"), match.group("post_n1") or match.group("post_n2")
- ),
- dev=_parse_letter_version(match.group("dev_l"), match.group("dev_n")),
- local=_parse_local_version(match.group("local")),
- )
-
- # Generate a key which will be used for sorting
- self._key = _cmpkey(
- self._version.epoch,
- self._version.release,
- self._version.pre,
- self._version.post,
- self._version.dev,
- self._version.local,
- )
-
- def __repr__(self):
- return "".format(repr(str(self)))
-
- def __str__(self):
- parts = []
-
- # Epoch
- if self._version.epoch != 0:
- parts.append("{0}!".format(self._version.epoch))
-
- # Release segment
- parts.append(".".join(str(x) for x in self._version.release))
-
- # Pre-release
- if self._version.pre is not None:
- parts.append("".join(str(x) for x in self._version.pre))
-
- # Post-release
- if self._version.post is not None:
- parts.append(".post{0}".format(self._version.post[1]))
-
- # Development release
- if self._version.dev is not None:
- parts.append(".dev{0}".format(self._version.dev[1]))
-
- # Local version segment
- if self._version.local is not None:
- parts.append("+{0}".format(".".join(str(x) for x in self._version.local)))
-
- return "".join(parts)
-
- @property
- def public(self):
- return str(self).split("+", 1)[0]
-
- @property
- def base_version(self):
- parts = []
-
- # Epoch
- if self._version.epoch != 0:
- parts.append("{0}!".format(self._version.epoch))
-
- # Release segment
- parts.append(".".join(str(x) for x in self._version.release))
-
- return "".join(parts)
-
- @property
- def local(self):
- version_string = str(self)
- if "+" in version_string:
- return version_string.split("+", 1)[1]
-
- @property
- def is_prerelease(self):
- return bool(self._version.dev or self._version.pre)
-
- @property
- def is_postrelease(self):
- return bool(self._version.post)
-
-
-def _parse_letter_version(letter, number):
- if letter:
- # We consider there to be an implicit 0 in a pre-release if there is
- # not a numeral associated with it.
- if number is None:
- number = 0
-
- # We normalize any letters to their lower case form
- letter = letter.lower()
-
- # We consider some words to be alternate spellings of other words and
- # in those cases we want to normalize the spellings to our preferred
- # spelling.
- if letter == "alpha":
- letter = "a"
- elif letter == "beta":
- letter = "b"
- elif letter in ["c", "pre", "preview"]:
- letter = "rc"
- elif letter in ["rev", "r"]:
- letter = "post"
-
- return letter, int(number)
- if not letter and number:
- # We assume if we are given a number, but we are not given a letter
- # then this is using the implicit post release syntax (e.g. 1.0-1)
- letter = "post"
-
- return letter, int(number)
-
-
-_local_version_seperators = re.compile(r"[._-]")
-
-
-def _parse_local_version(local):
- """
- Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
- """
- if local is not None:
- return tuple(
- part.lower() if not part.isdigit() else int(part)
- for part in _local_version_seperators.split(local)
- )
-
-
-def _cmpkey(epoch, release, pre, post, dev, local):
- # When we compare a release version, we want to compare it with all of the
- # trailing zeros removed. So we'll use a reverse the list, drop all the now
- # leading zeros until we come to something non zero, then take the rest
- # re-reverse it back into the correct order and make it a tuple and use
- # that for our sorting key.
- release = tuple(reversed(list(dropwhile(lambda x: x == 0, reversed(release)))))
-
- # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
- # We'll do this by abusing the pre segment, but we _only_ want to do this
- # if there is not a pre or a post segment. If we have one of those then
- # the normal sorting rules will handle this case correctly.
- if pre is None and post is None and dev is not None:
- pre = -Infinity
-
- # Versions without a pre-release (except as noted above) should sort after
- # those with one.
- elif pre is None:
- pre = Infinity
-
- # Versions without a post segment should sort before those with one.
- if post is None:
- post = -Infinity
-
- # Versions without a development segment should sort after those with one.
- if dev is None:
- dev = Infinity
-
- if local is None:
- # Versions without a local segment should sort before those with one.
- local = -Infinity
- else:
- # Versions with a local segment need that segment parsed to implement
- # the sorting rules in PEP440.
- # - Alpha numeric segments sort before numeric segments
- # - Alpha numeric segments sort lexicographically
- # - Numeric segments sort numerically
- # - Shorter versions sort before longer versions when the prefixes
- # match exactly
- local = tuple((i, "") if isinstance(i, int) else (-Infinity, i) for i in local)
-
- return epoch, release, pre, post, dev, local
diff --git a/poetry/version/version_selector.py b/poetry/version/version_selector.py
index 2077e322699..8cf02c7cbed 100644
--- a/poetry/version/version_selector.py
+++ b/poetry/version/version_selector.py
@@ -1,9 +1,9 @@
from typing import Union
-from poetry.packages import Dependency
-from poetry.packages import Package
-from poetry.semver import Version
-from poetry.semver import parse_constraint
+from poetry.core.packages import Dependency
+from poetry.core.packages import Package
+from poetry.core.semver import Version
+from poetry.core.semver import parse_constraint
class VersionSelector(object):
diff --git a/pyproject.toml b/pyproject.toml
index 938b89fe422..2b1940a3f65 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -22,15 +22,13 @@ classifiers = [
# Requirements
[tool.poetry.dependencies]
-python = "~2.7 || ^3.4"
+python = "~2.7 || ^3.5"
+poetry-core = "^1.0.0a5"
cleo = "^0.7.6"
-clikit = "^0.4.2"
+clikit = "^0.4.3"
requests = "^2.18"
cachy = "^0.3.0"
requests-toolbelt = "^0.8.0"
-jsonschema = "^3.1"
-pyrsistent = "^0.14.2"
-pyparsing = "^2.2"
cachecontrol = { version = "^0.12.4", extras = ["filecache"] }
pkginfo = "^1.4"
html5lib = "^1.0"
@@ -38,23 +36,23 @@ shellingham = "^1.1"
tomlkit = "^0.5.11"
pexpect = "^4.7.0"
-# The typing module is not in the stdlib in Python 2.7 and 3.4
-typing = { version = "^3.6", python = "~2.7 || ~3.4" }
+# The typing module is not in the stdlib in Python 2.7
+typing = { version = "^3.6", python = "~2.7" }
-# Use pathlib2 for Python 2.7 and 3.4
-pathlib2 = { version = "^2.3", python = "~2.7 || ~3.4" }
+# Use pathlib2 for Python 2.7
+pathlib2 = { version = "^2.3", python = "~2.7" }
# Use glob2 for Python 2.7 and 3.4
-glob2 = { version = "^0.6", python = "~2.7 || ~3.4" }
+glob2 = { version = "^0.6", python = "~2.7" }
# Use virtualenv for Python 2.7 since venv does not exist
virtualenv = { version = "^16.7.9", python = "~2.7" }
# functools32 is needed for Python 2.7
functools32 = { version = "^3.2.3", python = "~2.7" }
keyring = [
- { version = "^18.0.1", python = "~2.7 || ~3.4" },
+ { version = "^18.0.1", python = "~2.7" },
{ version = "^20.0.1", python = "^3.5" }
]
-# Use subprocess32 for Python 2.7 and 3.4
-subprocess32 = { version = "^3.5", python = "~2.7 || ~3.4" }
+# Use subprocess32 for Python 2.7
+subprocess32 = { version = "^3.5", python = "~2.7" }
importlib-metadata = {version = "~1.1.3", python = "<3.8"}
[tool.poetry.dev-dependencies]
@@ -77,11 +75,8 @@ poetry = "poetry.console:main"
[build-system]
-requires = ["intreehooks"]
-build-backend = "intreehooks:loader"
-
-[tool.intreehooks]
-build-backend = "poetry.masonry.api"
+requires = ["poetry-core>=1.0.0a3"]
+build-backend = "poetry.core.masonry.api"
[tool.isort]
@@ -109,6 +104,7 @@ known_third_party = [
"keyring",
"pexpect",
"pkginfo",
+ "poetry_core",
"pyparsing",
"pytest",
"requests",
diff --git a/sonnet b/sonnet
index dc4b541275d..1d32cfbaa6e 100755
--- a/sonnet
+++ b/sonnet
@@ -25,7 +25,6 @@ class MakeReleaseCommand(Command):
PYTHON = {
"2.7": "python2.7",
- "3.4": "python3.4",
"3.5": "python3.5",
"3.6": "python3.6",
"3.7": "python3.7",
@@ -47,7 +46,8 @@ class MakeReleaseCommand(Command):
self.check_system(pythons)
- from poetry import __version__
+ from poetry.__version__ import __version__
+ from poetry.core.vcs import get_vcs
from poetry.factory import Factory
from poetry.puzzle import Solver
from poetry.repositories.pool import Pool
@@ -59,7 +59,6 @@ class MakeReleaseCommand(Command):
from poetry.utils.env import GET_BASE_PREFIX
from poetry.utils.env import VirtualEnv
from poetry.utils.helpers import temporary_directory
- from poetry.vcs import get_vcs
project = Factory().create_poetry(Path.cwd())
package = project.package
diff --git a/tests/conftest.py b/tests/conftest.py
index d5ff7f488c9..c70923321b0 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -87,9 +87,9 @@ def environ():
@pytest.fixture(autouse=True)
def git_mock(mocker):
# Patch git module to not actually clone projects
- mocker.patch("poetry.vcs.git.Git.clone", new=mock_clone)
- mocker.patch("poetry.vcs.git.Git.checkout", new=lambda *_: None)
- p = mocker.patch("poetry.vcs.git.Git.rev_parse")
+ mocker.patch("poetry.core.vcs.git.Git.clone", new=mock_clone)
+ mocker.patch("poetry.core.vcs.git.Git.checkout", new=lambda *_: None)
+ p = mocker.patch("poetry.core.vcs.git.Git.rev_parse")
p.return_value = "9cf87a285a2d3fbb0b9fa621997b3acc3631ed24"
diff --git a/tests/console/commands/env/test_use.py b/tests/console/commands/env/test_use.py
index 2b1967bf3b1..ac042c93b05 100644
--- a/tests/console/commands/env/test_use.py
+++ b/tests/console/commands/env/test_use.py
@@ -6,7 +6,7 @@
from cleo.testers import CommandTester
-from poetry.semver import Version
+from poetry.core.semver import Version
from poetry.utils._compat import Path
from poetry.utils.env import EnvManager
from poetry.utils.env import MockEnv
diff --git a/tests/console/commands/test_add.py b/tests/console/commands/test_add.py
index 8e7f4a870c8..a0b8d3c22dd 100644
--- a/tests/console/commands/test_add.py
+++ b/tests/console/commands/test_add.py
@@ -4,8 +4,8 @@
from cleo.testers import CommandTester
+from poetry.core.semver import Version
from poetry.repositories.legacy_repository import LegacyRepository
-from poetry.semver import Version
from poetry.utils._compat import Path
from tests.helpers import get_dependency
from tests.helpers import get_package
diff --git a/tests/console/commands/test_publish.py b/tests/console/commands/test_publish.py
index 856878a57a4..5415694fa3c 100644
--- a/tests/console/commands/test_publish.py
+++ b/tests/console/commands/test_publish.py
@@ -22,7 +22,7 @@ def test_publish_returns_non_zero_code_for_upload_errors(app, app_tester, http):
def test_publish_with_cert(app_tester, mocker):
- publisher_publish = mocker.patch("poetry.masonry.publishing.Publisher.publish")
+ publisher_publish = mocker.patch("poetry.publishing.Publisher.publish")
app_tester.execute("publish --cert path/to/ca.pem")
@@ -32,7 +32,7 @@ def test_publish_with_cert(app_tester, mocker):
def test_publish_with_client_cert(app_tester, mocker):
- publisher_publish = mocker.patch("poetry.masonry.publishing.Publisher.publish")
+ publisher_publish = mocker.patch("poetry.publishing.Publisher.publish")
app_tester.execute("publish --client-cert path/to/client.pem")
assert [
diff --git a/tests/console/conftest.py b/tests/console/conftest.py
index 58b8834aa61..16555c54f2b 100644
--- a/tests/console/conftest.py
+++ b/tests/console/conftest.py
@@ -49,9 +49,9 @@ def setup(mocker, installer, installed, config, env):
p.return_value = installed
# Patch git module to not actually clone projects
- mocker.patch("poetry.vcs.git.Git.clone", new=mock_clone)
- mocker.patch("poetry.vcs.git.Git.checkout", new=lambda *_: None)
- p = mocker.patch("poetry.vcs.git.Git.rev_parse")
+ mocker.patch("poetry.core.vcs.git.Git.clone", new=mock_clone)
+ mocker.patch("poetry.core.vcs.git.Git.checkout", new=lambda *_: None)
+ p = mocker.patch("poetry.core.vcs.git.Git.rev_parse")
p.return_value = "9cf87a285a2d3fbb0b9fa621997b3acc3631ed24"
# Patch download to not download anything but to just copy from fixtures
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/README.rst b/tests/fixtures/excluded_subpackage/README.rst
similarity index 100%
rename from tests/masonry/builders/fixtures/case_sensitive_exclusions/README.rst
rename to tests/fixtures/excluded_subpackage/README.rst
diff --git a/tests/masonry/builders/fixtures/excluded_subpackage/example/__init__.py b/tests/fixtures/excluded_subpackage/example/__init__.py
similarity index 100%
rename from tests/masonry/builders/fixtures/excluded_subpackage/example/__init__.py
rename to tests/fixtures/excluded_subpackage/example/__init__.py
diff --git a/poetry/masonry/utils/__init__.py b/tests/fixtures/excluded_subpackage/example/test/__init__.py
similarity index 100%
rename from poetry/masonry/utils/__init__.py
rename to tests/fixtures/excluded_subpackage/example/test/__init__.py
diff --git a/tests/masonry/builders/fixtures/excluded_subpackage/example/test/excluded.py b/tests/fixtures/excluded_subpackage/example/test/excluded.py
similarity index 100%
rename from tests/masonry/builders/fixtures/excluded_subpackage/example/test/excluded.py
rename to tests/fixtures/excluded_subpackage/example/test/excluded.py
diff --git a/tests/masonry/builders/fixtures/excluded_subpackage/pyproject.toml b/tests/fixtures/excluded_subpackage/pyproject.toml
similarity index 100%
rename from tests/masonry/builders/fixtures/excluded_subpackage/pyproject.toml
rename to tests/fixtures/excluded_subpackage/pyproject.toml
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/LICENSE b/tests/fixtures/with-include/LICENSE
similarity index 100%
rename from tests/masonry/builders/fixtures/case_sensitive_exclusions/LICENSE
rename to tests/fixtures/with-include/LICENSE
diff --git a/tests/masonry/builders/fixtures/complete/README.rst b/tests/fixtures/with-include/README.rst
similarity index 100%
rename from tests/masonry/builders/fixtures/complete/README.rst
rename to tests/fixtures/with-include/README.rst
diff --git a/tests/masonry/builders/fixtures/with-include/extra_dir/README.md b/tests/fixtures/with-include/extra_dir/README.md
similarity index 100%
rename from tests/masonry/builders/fixtures/with-include/extra_dir/README.md
rename to tests/fixtures/with-include/extra_dir/README.md
diff --git a/poetry/packages/utils/__init__.py b/tests/fixtures/with-include/extra_dir/__init__.py
similarity index 100%
rename from poetry/packages/utils/__init__.py
rename to tests/fixtures/with-include/extra_dir/__init__.py
diff --git a/tests/json/__init__.py b/tests/fixtures/with-include/extra_dir/sub_pkg/__init__.py
similarity index 100%
rename from tests/json/__init__.py
rename to tests/fixtures/with-include/extra_dir/sub_pkg/__init__.py
diff --git a/tests/masonry/builders/fixtures/with-include/extra_dir/sub_pkg/vcs_excluded.txt b/tests/fixtures/with-include/extra_dir/sub_pkg/vcs_excluded.txt
similarity index 100%
rename from tests/masonry/builders/fixtures/with-include/extra_dir/sub_pkg/vcs_excluded.txt
rename to tests/fixtures/with-include/extra_dir/sub_pkg/vcs_excluded.txt
diff --git a/tests/masonry/builders/fixtures/with-include/extra_dir/vcs_excluded.txt b/tests/fixtures/with-include/extra_dir/vcs_excluded.txt
similarity index 100%
rename from tests/masonry/builders/fixtures/with-include/extra_dir/vcs_excluded.txt
rename to tests/fixtures/with-include/extra_dir/vcs_excluded.txt
diff --git a/tests/masonry/__init__.py b/tests/fixtures/with-include/for_wheel_only/__init__.py
similarity index 100%
rename from tests/masonry/__init__.py
rename to tests/fixtures/with-include/for_wheel_only/__init__.py
diff --git a/tests/masonry/builders/fixtures/with-include/my_module.py b/tests/fixtures/with-include/my_module.py
similarity index 100%
rename from tests/masonry/builders/fixtures/with-include/my_module.py
rename to tests/fixtures/with-include/my_module.py
diff --git a/tests/masonry/builders/fixtures/with-include/notes.txt b/tests/fixtures/with-include/notes.txt
similarity index 100%
rename from tests/masonry/builders/fixtures/with-include/notes.txt
rename to tests/fixtures/with-include/notes.txt
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/__init__.py b/tests/fixtures/with-include/package_with_include/__init__.py
similarity index 100%
rename from tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/__init__.py
rename to tests/fixtures/with-include/package_with_include/__init__.py
diff --git a/tests/masonry/builders/fixtures/with-include/pyproject.toml b/tests/fixtures/with-include/pyproject.toml
similarity index 100%
rename from tests/masonry/builders/fixtures/with-include/pyproject.toml
rename to tests/fixtures/with-include/pyproject.toml
diff --git a/tests/masonry/builders/__init__.py b/tests/fixtures/with-include/src/src_package/__init__.py
similarity index 100%
rename from tests/masonry/builders/__init__.py
rename to tests/fixtures/with-include/src/src_package/__init__.py
diff --git a/tests/masonry/builders/fixtures/complete/my_package/sub_pkg1/__init__.py b/tests/fixtures/with-include/tests/__init__.py
similarity index 100%
rename from tests/masonry/builders/fixtures/complete/my_package/sub_pkg1/__init__.py
rename to tests/fixtures/with-include/tests/__init__.py
diff --git a/tests/helpers.py b/tests/helpers.py
index 6f5f73f163b..d9575be8e32 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -1,13 +1,13 @@
import os
import shutil
-from poetry.packages import Dependency
-from poetry.packages import Package
+from poetry.core.packages import Dependency
+from poetry.core.packages import Package
+from poetry.core.vcs.git import ParsedUrl
from poetry.utils._compat import PY2
from poetry.utils._compat import WINDOWS
from poetry.utils._compat import Path
from poetry.utils._compat import urlparse
-from poetry.vcs.git import ParsedUrl
FIXTURE_PATH = Path(__file__).parent / "fixtures"
diff --git a/tests/installation/test_installer.py b/tests/installation/test_installer.py
index c236141be44..dadbb6be82b 100644
--- a/tests/installation/test_installer.py
+++ b/tests/installation/test_installer.py
@@ -6,10 +6,10 @@
from clikit.io import NullIO
+from poetry.core.packages import ProjectPackage
from poetry.installation import Installer as BaseInstaller
from poetry.installation.noop_installer import NoopInstaller
from poetry.packages import Locker as BaseLocker
-from poetry.packages import ProjectPackage
from poetry.repositories import Pool
from poetry.repositories import Repository
from poetry.repositories.installed_repository import InstalledRepository
diff --git a/tests/installation/test_pip_installer.py b/tests/installation/test_pip_installer.py
index fe40328aa1a..f3cf376ff39 100644
--- a/tests/installation/test_pip_installer.py
+++ b/tests/installation/test_pip_installer.py
@@ -1,8 +1,8 @@
import pytest
+from poetry.core.packages.package import Package
from poetry.installation.pip_installer import PipInstaller
from poetry.io.null_io import NullIO
-from poetry.packages.package import Package
from poetry.repositories.legacy_repository import LegacyRepository
from poetry.repositories.pool import Pool
from poetry.utils._compat import Path
diff --git a/tests/json/test_poetry_schema.py b/tests/json/test_poetry_schema.py
deleted file mode 100644
index 48ebcd2311a..00000000000
--- a/tests/json/test_poetry_schema.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import pytest
-
-from poetry.json import validate_object
-
-
-@pytest.fixture
-def base_object():
- return {
- "name": "myapp",
- "version": "1.0.0",
- "description": "Some description.",
- "dependencies": {"python": "^3.6"},
- "dev-dependencies": {},
- }
-
-
-@pytest.fixture
-def multi_url_object():
- return {
- "name": "myapp",
- "version": "1.0.0",
- "description": "Some description.",
- "dependencies": {
- "python": [
- {
- "url": "https://download.pytorch.org/whl/cpu/torch-1.4.0%2Bcpu-cp37-cp37m-linux_x86_64.whl",
- "platform": "linux",
- },
- {"path": "../foo", "platform": "darwin"},
- ]
- },
- "dev-dependencies": {},
- }
-
-
-def test_path_dependencies(base_object):
- base_object["dependencies"].update({"foo": {"path": "../foo"}})
- base_object["dev-dependencies"].update({"foo": {"path": "../foo"}})
-
- assert len(validate_object(base_object, "poetry-schema")) == 0
-
-
-def test_multi_url_dependencies(multi_url_object):
- assert len(validate_object(multi_url_object, "poetry-schema")) == 0
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/Bar.py b/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/Bar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/IncludedBar.py b/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/IncludedBar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/SecondBar.py b/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/SecondBar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/lowercasebar.py b/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/lowercasebar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/FooBar/Bar.py b/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/FooBar/Bar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/FooBar/lowercasebar.py b/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/FooBar/lowercasebar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/bar/CapitalFoo.py b/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/bar/CapitalFoo.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/bar/foo.py b/tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/bar/foo.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/case_sensitive_exclusions/pyproject.toml b/tests/masonry/builders/fixtures/case_sensitive_exclusions/pyproject.toml
deleted file mode 100644
index 57d25a4314f..00000000000
--- a/tests/masonry/builders/fixtures/case_sensitive_exclusions/pyproject.toml
+++ /dev/null
@@ -1,49 +0,0 @@
-[tool.poetry]
-name = "my-package"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org/"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-exclude = [
- "**/SecondBar.py",
- "my_package/FooBar/*",
- "my_package/Foo/Bar.py",
- "my_package/Foo/lowercasebar.py",
- "my_package/bar/foo.py",
- "my_package/bar/CapitalFoo.py"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = "^0.6"
-cachy = { version = "^0.2.0", extras = ["msgpack"] }
-
-pendulum = { version = "^1.4", optional = true }
-
-[tool.poetry.dev-dependencies]
-pytest = "~3.4"
-
-[tool.poetry.extras]
-time = ["pendulum"]
-
-[tool.poetry.scripts]
-my-script = "my_package:main"
-my-2nd-script = "my_package:main2"
-extra-script = {callable = "my_package.extra:main", extras = ["time"]}
diff --git a/tests/masonry/builders/fixtures/complete/LICENSE b/tests/masonry/builders/fixtures/complete/LICENSE
deleted file mode 100644
index 44cf2b30e68..00000000000
--- a/tests/masonry/builders/fixtures/complete/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2018 Sébastien Eustace
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tests/masonry/builders/fixtures/complete/my_package/__init__.py b/tests/masonry/builders/fixtures/complete/my_package/__init__.py
deleted file mode 100644
index 10aa336ce07..00000000000
--- a/tests/masonry/builders/fixtures/complete/my_package/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-__version__ = "1.2.3"
diff --git a/tests/masonry/builders/fixtures/complete/my_package/data1/test.json b/tests/masonry/builders/fixtures/complete/my_package/data1/test.json
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/complete/my_package/sub_pkg1/extra_file.xml b/tests/masonry/builders/fixtures/complete/my_package/sub_pkg1/extra_file.xml
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/complete/my_package/sub_pkg2/data2/data.json b/tests/masonry/builders/fixtures/complete/my_package/sub_pkg2/data2/data.json
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/complete/my_package/sub_pkg3/foo.py b/tests/masonry/builders/fixtures/complete/my_package/sub_pkg3/foo.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/complete/pyproject.toml b/tests/masonry/builders/fixtures/complete/pyproject.toml
deleted file mode 100644
index 13834964e82..00000000000
--- a/tests/masonry/builders/fixtures/complete/pyproject.toml
+++ /dev/null
@@ -1,53 +0,0 @@
-[tool.poetry]
-name = "my-package"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-maintainers = [
- "People Everywhere "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org/"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-exclude = [
- "**/*.xml"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = "^0.6"
-cachy = { version = "^0.2.0", extras = ["msgpack"] }
-
-[tool.poetry.dependencies.pendulum]
-version = "^1.4"
-markers= 'python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5"'
-optional = true
-
-[tool.poetry.dev-dependencies]
-pytest = "~3.4"
-
-[tool.poetry.extras]
-time = ["pendulum"]
-
-[tool.poetry.scripts]
-my-script = "my_package:main"
-my-2nd-script = "my_package:main2"
-extra-script = {callable = "my_package.extra:main", extras = ["time"]}
-
-[tool.poetry.urls]
-"Issue Tracker" = "https://github.com/python-poetry/poetry/issues"
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data/LICENSE b/tests/masonry/builders/fixtures/default_with_excluded_data/LICENSE
deleted file mode 100644
index 44cf2b30e68..00000000000
--- a/tests/masonry/builders/fixtures/default_with_excluded_data/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2018 Sébastien Eustace
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data/README.rst b/tests/masonry/builders/fixtures/default_with_excluded_data/README.rst
deleted file mode 100644
index f7fe15470f9..00000000000
--- a/tests/masonry/builders/fixtures/default_with_excluded_data/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-My Package
-==========
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data/my_package/__init__.py b/tests/masonry/builders/fixtures/default_with_excluded_data/my_package/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data/my_package/data/data1.txt b/tests/masonry/builders/fixtures/default_with_excluded_data/my_package/data/data1.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data/my_package/data/sub_data/data2.txt b/tests/masonry/builders/fixtures/default_with_excluded_data/my_package/data/sub_data/data2.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data/my_package/data/sub_data/data3.txt b/tests/masonry/builders/fixtures/default_with_excluded_data/my_package/data/sub_data/data3.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data/pyproject.toml b/tests/masonry/builders/fixtures/default_with_excluded_data/pyproject.toml
deleted file mode 100644
index 80e86166ad8..00000000000
--- a/tests/masonry/builders/fixtures/default_with_excluded_data/pyproject.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-[tool.poetry]
-name = "my-package"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org/"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = "^0.6"
-cachy = { version = "^0.2.0", extras = ["msgpack"] }
-
-pendulum = { version = "^1.4", optional = true }
-
-[tool.poetry.dev-dependencies]
-pytest = "~3.4"
-
-[tool.poetry.extras]
-time = ["pendulum"]
-
-[tool.poetry.scripts]
-my-script = "my_package:main"
-my-2nd-script = "my_package:main2"
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data_toml/LICENSE b/tests/masonry/builders/fixtures/default_with_excluded_data_toml/LICENSE
deleted file mode 100644
index 44cf2b30e68..00000000000
--- a/tests/masonry/builders/fixtures/default_with_excluded_data_toml/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2018 Sébastien Eustace
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data_toml/README.rst b/tests/masonry/builders/fixtures/default_with_excluded_data_toml/README.rst
deleted file mode 100644
index f7fe15470f9..00000000000
--- a/tests/masonry/builders/fixtures/default_with_excluded_data_toml/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-My Package
-==========
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data_toml/my_package/__init__.py b/tests/masonry/builders/fixtures/default_with_excluded_data_toml/my_package/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data_toml/my_package/data/data1.txt b/tests/masonry/builders/fixtures/default_with_excluded_data_toml/my_package/data/data1.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data_toml/my_package/data/sub_data/data2.txt b/tests/masonry/builders/fixtures/default_with_excluded_data_toml/my_package/data/sub_data/data2.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data_toml/my_package/data/sub_data/data3.txt b/tests/masonry/builders/fixtures/default_with_excluded_data_toml/my_package/data/sub_data/data3.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/default_with_excluded_data_toml/pyproject.toml b/tests/masonry/builders/fixtures/default_with_excluded_data_toml/pyproject.toml
deleted file mode 100644
index fcd31fa2007..00000000000
--- a/tests/masonry/builders/fixtures/default_with_excluded_data_toml/pyproject.toml
+++ /dev/null
@@ -1,41 +0,0 @@
-[tool.poetry]
-name = "my-package"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-exclude = ["my_package/data/data1.txt"]
-
-homepage = "https://python-poetry.org/"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = "^0.6"
-cachy = { version = "^0.2.0", extras = ["msgpack"] }
-
-pendulum = { version = "^1.4", optional = true }
-
-[tool.poetry.dev-dependencies]
-pytest = "~3.4"
-
-[tool.poetry.extras]
-time = ["pendulum"]
-
-[tool.poetry.scripts]
-my-script = "my_package:main"
-my-2nd-script = "my_package:main2"
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/LICENSE b/tests/masonry/builders/fixtures/exclude_nested_data_toml/LICENSE
deleted file mode 100644
index 44cf2b30e68..00000000000
--- a/tests/masonry/builders/fixtures/exclude_nested_data_toml/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2018 Sébastien Eustace
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/README.rst b/tests/masonry/builders/fixtures/exclude_nested_data_toml/README.rst
deleted file mode 100644
index f7fe15470f9..00000000000
--- a/tests/masonry/builders/fixtures/exclude_nested_data_toml/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-My Package
-==========
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/__init__.py b/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/data/data1.txt b/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/data/data1.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/data/data2.txt b/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/data/data2.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/data/sub_data/data2.txt b/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/data/sub_data/data2.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/data/sub_data/data3.txt b/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/data/sub_data/data3.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/puplic/item1/itemdata1.txt b/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/puplic/item1/itemdata1.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/puplic/item1/subitem/subitemdata.txt b/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/puplic/item1/subitem/subitemdata.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/puplic/item2/itemdata2.txt b/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/puplic/item2/itemdata2.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/puplic/publicdata.txt b/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/puplic/publicdata.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/pyproject.toml b/tests/masonry/builders/fixtures/exclude_nested_data_toml/pyproject.toml
deleted file mode 100644
index 28cff3c5414..00000000000
--- a/tests/masonry/builders/fixtures/exclude_nested_data_toml/pyproject.toml
+++ /dev/null
@@ -1,42 +0,0 @@
-[tool.poetry]
-name = "my-package"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-exclude = ["**/data/", "**/*/item*"]
-include = ["my_package/data/data2.txt"]
-
-homepage = "https://python-poetry.org/"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = "^0.6"
-cachy = { version = "^0.2.0", extras = ["msgpack"] }
-
-pendulum = { version = "^1.4", optional = true }
-
-[tool.poetry.dev-dependencies]
-pytest = "~3.4"
-
-[tool.poetry.extras]
-time = ["pendulum"]
-
-[tool.poetry.scripts]
-my-script = "my_package:main"
-my-2nd-script = "my_package:main2"
diff --git a/tests/masonry/builders/fixtures/excluded_subpackage/README.rst b/tests/masonry/builders/fixtures/excluded_subpackage/README.rst
deleted file mode 100644
index b00640203c5..00000000000
--- a/tests/masonry/builders/fixtures/excluded_subpackage/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-My Package
-==========
\ No newline at end of file
diff --git a/tests/masonry/builders/fixtures/excluded_subpackage/example/test/__init__.py b/tests/masonry/builders/fixtures/excluded_subpackage/example/test/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/extended/README.rst b/tests/masonry/builders/fixtures/extended/README.rst
deleted file mode 100644
index a7508bd515e..00000000000
--- a/tests/masonry/builders/fixtures/extended/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Module 1
-========
diff --git a/tests/masonry/builders/fixtures/extended/build.py b/tests/masonry/builders/fixtures/extended/build.py
deleted file mode 100644
index 5308ec59b05..00000000000
--- a/tests/masonry/builders/fixtures/extended/build.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from distutils.core import Extension
-
-extensions = [Extension("extended.extended", ["extended/extended.c"])]
-
-
-def build(setup_kwargs):
- setup_kwargs.update({"ext_modules": extensions})
diff --git a/tests/masonry/builders/fixtures/extended/extended/__init__.py b/tests/masonry/builders/fixtures/extended/extended/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/extended/extended/extended.c b/tests/masonry/builders/fixtures/extended/extended/extended.c
deleted file mode 100644
index 25a028eb11e..00000000000
--- a/tests/masonry/builders/fixtures/extended/extended/extended.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include
-
-
-static PyObject *hello(PyObject *self) {
- return PyUnicode_FromString("Hello");
-}
-
-
-static PyMethodDef module_methods[] = {
- {
- "hello",
- (PyCFunction) hello,
- NULL,
- PyDoc_STR("Say hello.")
- },
- {NULL}
-};
-
-#if PY_MAJOR_VERSION >= 3
-static struct PyModuleDef moduledef = {
- PyModuleDef_HEAD_INIT,
- "extended",
- NULL,
- -1,
- module_methods,
- NULL,
- NULL,
- NULL,
- NULL,
-};
-#endif
-
-PyMODINIT_FUNC
-#if PY_MAJOR_VERSION >= 3
-PyInit_extended(void)
-#else
-init_extended(void)
-#endif
-{
- PyObject *module;
-
-#if PY_MAJOR_VERSION >= 3
- module = PyModule_Create(&moduledef);
-#else
- module = Py_InitModule3("extended", module_methods, NULL);
-#endif
-
- if (module == NULL)
-#if PY_MAJOR_VERSION >= 3
- return NULL;
-#else
- return;
-#endif
-
-#if PY_MAJOR_VERSION >= 3
- return module;
-#endif
-}
diff --git a/tests/masonry/builders/fixtures/extended/pyproject.toml b/tests/masonry/builders/fixtures/extended/pyproject.toml
deleted file mode 100644
index f8e8bd8105f..00000000000
--- a/tests/masonry/builders/fixtures/extended/pyproject.toml
+++ /dev/null
@@ -1,14 +0,0 @@
-[tool.poetry]
-name = "extended"
-version = "0.1"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org/"
-
-build = "build.py"
diff --git a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/LICENSE b/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/LICENSE
deleted file mode 100644
index 44cf2b30e68..00000000000
--- a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2018 Sébastien Eustace
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/README.rst b/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/README.rst
deleted file mode 100644
index f7fe15470f9..00000000000
--- a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-My Package
-==========
diff --git a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Bar/foo/bar/Foo.py b/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Bar/foo/bar/Foo.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/Bar.py b/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/Bar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/IncludedBar.py b/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/IncludedBar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/SecondBar.py b/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/SecondBar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/lowercasebar.py b/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/lowercasebar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/FooBar/Bar.py b/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/FooBar/Bar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/FooBar/lowercasebar.py b/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/FooBar/lowercasebar.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/__init__.py b/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/__init__.py
deleted file mode 100644
index 10aa336ce07..00000000000
--- a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-__version__ = "1.2.3"
diff --git a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/pyproject.toml b/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/pyproject.toml
deleted file mode 100644
index 6ef10e5959b..00000000000
--- a/tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/pyproject.toml
+++ /dev/null
@@ -1,44 +0,0 @@
-[tool.poetry]
-name = "my-package"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org/"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-exclude = [
- "my_package/Bar/*/bar/*.py"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = "^0.6"
-cachy = { version = "^0.2.0", extras = ["msgpack"] }
-
-pendulum = { version = "^1.4", optional = true }
-
-[tool.poetry.dev-dependencies]
-pytest = "~3.4"
-
-[tool.poetry.extras]
-time = ["pendulum"]
-
-[tool.poetry.scripts]
-my-script = "my_package:main"
-my-2nd-script = "my_package:main2"
-extra-script = {callable = "my_package.extra:main", extras = ["time"]}
diff --git a/tests/masonry/builders/fixtures/localversionlabel/localversionlabel.py b/tests/masonry/builders/fixtures/localversionlabel/localversionlabel.py
deleted file mode 100644
index 0f503ecd7c0..00000000000
--- a/tests/masonry/builders/fixtures/localversionlabel/localversionlabel.py
+++ /dev/null
@@ -1 +0,0 @@
-"""Test fixture for https://github.com/python-poetry/poetry/issues/756"""
diff --git a/tests/masonry/builders/fixtures/localversionlabel/pyproject.toml b/tests/masonry/builders/fixtures/localversionlabel/pyproject.toml
deleted file mode 100644
index 4b5f4dddb18..00000000000
--- a/tests/masonry/builders/fixtures/localversionlabel/pyproject.toml
+++ /dev/null
@@ -1,5 +0,0 @@
-[tool.poetry]
-name = "localversionlabel"
-description = "Local Version Label"
-version = "0.1-beta.1+gitbranch-buildno-1"
-authors = []
diff --git a/tests/masonry/builders/fixtures/module1/README.rst b/tests/masonry/builders/fixtures/module1/README.rst
deleted file mode 100644
index a7508bd515e..00000000000
--- a/tests/masonry/builders/fixtures/module1/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Module 1
-========
diff --git a/tests/masonry/builders/fixtures/module1/module1.py b/tests/masonry/builders/fixtures/module1/module1.py
deleted file mode 100644
index 7ef41c5d4ea..00000000000
--- a/tests/masonry/builders/fixtures/module1/module1.py
+++ /dev/null
@@ -1,3 +0,0 @@
-"""Example module"""
-
-__version__ = "0.1"
diff --git a/tests/masonry/builders/fixtures/module1/pyproject.toml b/tests/masonry/builders/fixtures/module1/pyproject.toml
deleted file mode 100644
index fd5af3aa164..00000000000
--- a/tests/masonry/builders/fixtures/module1/pyproject.toml
+++ /dev/null
@@ -1,16 +0,0 @@
-[tool.poetry]
-name = "module1"
-version = "0.1"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org/"
-
-
-[tool.poetry.dependencies]
-python = "*"
diff --git a/tests/masonry/builders/fixtures/prerelease/README.rst b/tests/masonry/builders/fixtures/prerelease/README.rst
deleted file mode 100644
index 77d54395b7d..00000000000
--- a/tests/masonry/builders/fixtures/prerelease/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Prerelease
-==========
diff --git a/tests/masonry/builders/fixtures/prerelease/prerelease.py b/tests/masonry/builders/fixtures/prerelease/prerelease.py
deleted file mode 100644
index 7ef41c5d4ea..00000000000
--- a/tests/masonry/builders/fixtures/prerelease/prerelease.py
+++ /dev/null
@@ -1,3 +0,0 @@
-"""Example module"""
-
-__version__ = "0.1"
diff --git a/tests/masonry/builders/fixtures/prerelease/pyproject.toml b/tests/masonry/builders/fixtures/prerelease/pyproject.toml
deleted file mode 100644
index 9e920c57ba1..00000000000
--- a/tests/masonry/builders/fixtures/prerelease/pyproject.toml
+++ /dev/null
@@ -1,12 +0,0 @@
-[tool.poetry]
-name = "prerelease"
-version = "0.1-beta.1"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org/"
diff --git a/tests/masonry/builders/fixtures/simple_version/README.rst b/tests/masonry/builders/fixtures/simple_version/README.rst
deleted file mode 100644
index a7508bd515e..00000000000
--- a/tests/masonry/builders/fixtures/simple_version/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Module 1
-========
diff --git a/tests/masonry/builders/fixtures/simple_version/pyproject.toml b/tests/masonry/builders/fixtures/simple_version/pyproject.toml
deleted file mode 100644
index 4a8767b9009..00000000000
--- a/tests/masonry/builders/fixtures/simple_version/pyproject.toml
+++ /dev/null
@@ -1,13 +0,0 @@
-[tool.poetry]
-name = "simple-version"
-version = "0.1"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-
-readme = "README.rst"
-
-
-[tool.poetry.dependencies]
-python = "3.6"
diff --git a/tests/masonry/builders/fixtures/simple_version/simple_version.py b/tests/masonry/builders/fixtures/simple_version/simple_version.py
deleted file mode 100644
index 7ef41c5d4ea..00000000000
--- a/tests/masonry/builders/fixtures/simple_version/simple_version.py
+++ /dev/null
@@ -1,3 +0,0 @@
-"""Example module"""
-
-__version__ = "0.1"
diff --git a/tests/masonry/builders/fixtures/single_python/README.rst b/tests/masonry/builders/fixtures/single_python/README.rst
deleted file mode 100644
index 265d70d6a73..00000000000
--- a/tests/masonry/builders/fixtures/single_python/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Single Python
-=============
diff --git a/tests/masonry/builders/fixtures/single_python/pyproject.toml b/tests/masonry/builders/fixtures/single_python/pyproject.toml
deleted file mode 100644
index 5aca79eb23e..00000000000
--- a/tests/masonry/builders/fixtures/single_python/pyproject.toml
+++ /dev/null
@@ -1,16 +0,0 @@
-[tool.poetry]
-name = "single-python"
-version = "0.1"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org/"
-
-
-[tool.poetry.dependencies]
-python = "2.7.15"
diff --git a/tests/masonry/builders/fixtures/single_python/single_python.py b/tests/masonry/builders/fixtures/single_python/single_python.py
deleted file mode 100644
index 7ef41c5d4ea..00000000000
--- a/tests/masonry/builders/fixtures/single_python/single_python.py
+++ /dev/null
@@ -1,3 +0,0 @@
-"""Example module"""
-
-__version__ = "0.1"
diff --git a/tests/masonry/builders/fixtures/source_file/README.rst b/tests/masonry/builders/fixtures/source_file/README.rst
deleted file mode 100644
index a7508bd515e..00000000000
--- a/tests/masonry/builders/fixtures/source_file/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Module 1
-========
diff --git a/tests/masonry/builders/fixtures/source_file/pyproject.toml b/tests/masonry/builders/fixtures/source_file/pyproject.toml
deleted file mode 100644
index 34b77e4ddaf..00000000000
--- a/tests/masonry/builders/fixtures/source_file/pyproject.toml
+++ /dev/null
@@ -1,16 +0,0 @@
-[tool.poetry]
-name = "module-src"
-version = "0.1"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org/"
-
-
-[tool.poetry.dependencies]
-python = "*"
diff --git a/tests/masonry/builders/fixtures/source_file/src/module_src.py b/tests/masonry/builders/fixtures/source_file/src/module_src.py
deleted file mode 100644
index 7ef41c5d4ea..00000000000
--- a/tests/masonry/builders/fixtures/source_file/src/module_src.py
+++ /dev/null
@@ -1,3 +0,0 @@
-"""Example module"""
-
-__version__ = "0.1"
diff --git a/tests/masonry/builders/fixtures/source_package/README.rst b/tests/masonry/builders/fixtures/source_package/README.rst
deleted file mode 100644
index a7508bd515e..00000000000
--- a/tests/masonry/builders/fixtures/source_package/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Module 1
-========
diff --git a/tests/masonry/builders/fixtures/source_package/pyproject.toml b/tests/masonry/builders/fixtures/source_package/pyproject.toml
deleted file mode 100644
index 4456fdb6c69..00000000000
--- a/tests/masonry/builders/fixtures/source_package/pyproject.toml
+++ /dev/null
@@ -1,15 +0,0 @@
-[tool.poetry]
-name = "package-src"
-version = "0.1"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org/"
-
-[tool.poetry.dependencies]
-python = "*"
diff --git a/tests/masonry/builders/fixtures/source_package/src/package_src/__init__.py b/tests/masonry/builders/fixtures/source_package/src/package_src/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/source_package/src/package_src/module.py b/tests/masonry/builders/fixtures/source_package/src/package_src/module.py
deleted file mode 100644
index 7ef41c5d4ea..00000000000
--- a/tests/masonry/builders/fixtures/source_package/src/package_src/module.py
+++ /dev/null
@@ -1,3 +0,0 @@
-"""Example module"""
-
-__version__ = "0.1"
diff --git a/tests/masonry/builders/fixtures/src_extended/README.rst b/tests/masonry/builders/fixtures/src_extended/README.rst
deleted file mode 100644
index a7508bd515e..00000000000
--- a/tests/masonry/builders/fixtures/src_extended/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Module 1
-========
diff --git a/tests/masonry/builders/fixtures/src_extended/build.py b/tests/masonry/builders/fixtures/src_extended/build.py
deleted file mode 100644
index 707bcaf24d5..00000000000
--- a/tests/masonry/builders/fixtures/src_extended/build.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from distutils.core import Extension
-
-extensions = [Extension("extended.extended", ["src/extended/extended.c"])]
-
-
-def build(setup_kwargs):
- setup_kwargs.update({"ext_modules": extensions})
diff --git a/tests/masonry/builders/fixtures/src_extended/pyproject.toml b/tests/masonry/builders/fixtures/src_extended/pyproject.toml
deleted file mode 100644
index f8e8bd8105f..00000000000
--- a/tests/masonry/builders/fixtures/src_extended/pyproject.toml
+++ /dev/null
@@ -1,14 +0,0 @@
-[tool.poetry]
-name = "extended"
-version = "0.1"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org/"
-
-build = "build.py"
diff --git a/tests/masonry/builders/fixtures/src_extended/src/extended/__init__.py b/tests/masonry/builders/fixtures/src_extended/src/extended/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/src_extended/src/extended/extended.c b/tests/masonry/builders/fixtures/src_extended/src/extended/extended.c
deleted file mode 100644
index 25a028eb11e..00000000000
--- a/tests/masonry/builders/fixtures/src_extended/src/extended/extended.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include
-
-
-static PyObject *hello(PyObject *self) {
- return PyUnicode_FromString("Hello");
-}
-
-
-static PyMethodDef module_methods[] = {
- {
- "hello",
- (PyCFunction) hello,
- NULL,
- PyDoc_STR("Say hello.")
- },
- {NULL}
-};
-
-#if PY_MAJOR_VERSION >= 3
-static struct PyModuleDef moduledef = {
- PyModuleDef_HEAD_INIT,
- "extended",
- NULL,
- -1,
- module_methods,
- NULL,
- NULL,
- NULL,
- NULL,
-};
-#endif
-
-PyMODINIT_FUNC
-#if PY_MAJOR_VERSION >= 3
-PyInit_extended(void)
-#else
-init_extended(void)
-#endif
-{
- PyObject *module;
-
-#if PY_MAJOR_VERSION >= 3
- module = PyModule_Create(&moduledef);
-#else
- module = Py_InitModule3("extended", module_methods, NULL);
-#endif
-
- if (module == NULL)
-#if PY_MAJOR_VERSION >= 3
- return NULL;
-#else
- return;
-#endif
-
-#if PY_MAJOR_VERSION >= 3
- return module;
-#endif
-}
diff --git a/tests/masonry/builders/fixtures/with-include/LICENSE b/tests/masonry/builders/fixtures/with-include/LICENSE
deleted file mode 100644
index 44cf2b30e68..00000000000
--- a/tests/masonry/builders/fixtures/with-include/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2018 Sébastien Eustace
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tests/masonry/builders/fixtures/with-include/README.rst b/tests/masonry/builders/fixtures/with-include/README.rst
deleted file mode 100644
index f7fe15470f9..00000000000
--- a/tests/masonry/builders/fixtures/with-include/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-My Package
-==========
diff --git a/tests/masonry/builders/fixtures/with-include/extra_dir/__init__.py b/tests/masonry/builders/fixtures/with-include/extra_dir/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/with-include/extra_dir/sub_pkg/__init__.py b/tests/masonry/builders/fixtures/with-include/extra_dir/sub_pkg/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/with-include/for_wheel_only/__init__.py b/tests/masonry/builders/fixtures/with-include/for_wheel_only/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/with-include/package_with_include/__init__.py b/tests/masonry/builders/fixtures/with-include/package_with_include/__init__.py
deleted file mode 100644
index 10aa336ce07..00000000000
--- a/tests/masonry/builders/fixtures/with-include/package_with_include/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-__version__ = "1.2.3"
diff --git a/tests/masonry/builders/fixtures/with-include/src/src_package/__init__.py b/tests/masonry/builders/fixtures/with-include/src/src_package/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/with-include/tests/__init__.py b/tests/masonry/builders/fixtures/with-include/tests/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/with_url_dependency/pyproject.toml b/tests/masonry/builders/fixtures/with_url_dependency/pyproject.toml
deleted file mode 100644
index c78f7aed61c..00000000000
--- a/tests/masonry/builders/fixtures/with_url_dependency/pyproject.toml
+++ /dev/null
@@ -1,24 +0,0 @@
-[tool.poetry]
-name = "with-url-dependency"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-homepage = "https://python-poetry.org/"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-demo = { url = "https://python-poetry.org/distributions/demo-0.1.0-py2.py3-none-any.whl" }
diff --git a/tests/masonry/builders/fixtures/with_url_dependency/with_url_dependency/__init__.py b/tests/masonry/builders/fixtures/with_url_dependency/with_url_dependency/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/fixtures/with_vcs_dependency/pyproject.toml b/tests/masonry/builders/fixtures/with_vcs_dependency/pyproject.toml
deleted file mode 100644
index 6fb808ffaad..00000000000
--- a/tests/masonry/builders/fixtures/with_vcs_dependency/pyproject.toml
+++ /dev/null
@@ -1,24 +0,0 @@
-[tool.poetry]
-name = "with-vcs-dependency"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-homepage = "https://python-poetry.org/"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = { git = "https://github.com/sdispater/cleo.git", branch = "master" }
diff --git a/tests/masonry/builders/fixtures/with_vcs_dependency/with_vcs_dependency/__init__.py b/tests/masonry/builders/fixtures/with_vcs_dependency/with_vcs_dependency/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/builders/test_builder.py b/tests/masonry/builders/test_builder.py
deleted file mode 100644
index 70817e12851..00000000000
--- a/tests/masonry/builders/test_builder.py
+++ /dev/null
@@ -1,159 +0,0 @@
-# -*- coding: utf-8 -*-
-from email.parser import Parser
-
-from clikit.io import NullIO
-
-from poetry.factory import Factory
-from poetry.masonry.builders.builder import Builder
-from poetry.utils._compat import Path
-from poetry.utils.env import NullEnv
-
-
-def test_builder_find_excluded_files(mocker):
- p = mocker.patch("poetry.vcs.git.Git.get_ignored_files")
- p.return_value = []
-
- builder = Builder(
- Factory().create_poetry(Path(__file__).parent / "fixtures" / "complete"),
- NullEnv(),
- NullIO(),
- )
-
- assert builder.find_excluded_files() == {"my_package/sub_pkg1/extra_file.xml"}
-
-
-def test_builder_find_case_sensitive_excluded_files(mocker):
- p = mocker.patch("poetry.vcs.git.Git.get_ignored_files")
- p.return_value = []
-
- builder = Builder(
- Factory().create_poetry(
- Path(__file__).parent / "fixtures" / "case_sensitive_exclusions"
- ),
- NullEnv(),
- NullIO(),
- )
-
- assert builder.find_excluded_files() == {
- "my_package/FooBar/Bar.py",
- "my_package/FooBar/lowercasebar.py",
- "my_package/Foo/SecondBar.py",
- "my_package/Foo/Bar.py",
- "my_package/Foo/lowercasebar.py",
- "my_package/bar/foo.py",
- "my_package/bar/CapitalFoo.py",
- }
-
-
-def test_builder_find_invalid_case_sensitive_excluded_files(mocker):
- p = mocker.patch("poetry.vcs.git.Git.get_ignored_files")
- p.return_value = []
-
- builder = Builder(
- Factory().create_poetry(
- Path(__file__).parent / "fixtures" / "invalid_case_sensitive_exclusions"
- ),
- NullEnv(),
- NullIO(),
- )
-
- assert {"my_package/Bar/foo/bar/Foo.py"} == builder.find_excluded_files()
-
-
-def test_get_metadata_content():
- builder = Builder(
- Factory().create_poetry(Path(__file__).parent / "fixtures" / "complete"),
- NullEnv(),
- NullIO(),
- )
-
- metadata = builder.get_metadata_content()
-
- p = Parser()
- parsed = p.parsestr(metadata)
-
- assert parsed["Metadata-Version"] == "2.1"
- assert parsed["Name"] == "my-package"
- assert parsed["Version"] == "1.2.3"
- assert parsed["Summary"] == "Some description."
- assert parsed["Author"] == "Sébastien Eustace"
- assert parsed["Author-email"] == "sebastien@eustace.io"
- assert parsed["Keywords"] == "packaging,dependency,poetry"
- assert parsed["Requires-Python"] == ">=3.6,<4.0"
- assert parsed["License"] == "MIT"
- assert parsed["Home-page"] == "https://python-poetry.org/"
-
- classifiers = parsed.get_all("Classifier")
- assert classifiers == [
- "License :: OSI Approved :: MIT License",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.6",
- "Programming Language :: Python :: 3.7",
- "Programming Language :: Python :: 3.8",
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules",
- ]
-
- extras = parsed.get_all("Provides-Extra")
- assert extras == ["time"]
-
- requires = parsed.get_all("Requires-Dist")
- assert requires == [
- "cachy[msgpack] (>=0.2.0,<0.3.0)",
- "cleo (>=0.6,<0.7)",
- 'pendulum (>=1.4,<2.0); (python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5") and (extra == "time")',
- ]
-
- urls = parsed.get_all("Project-URL")
- assert urls == [
- "Documentation, https://python-poetry.org/docs",
- "Issue Tracker, https://github.com/python-poetry/poetry/issues",
- "Repository, https://github.com/python-poetry/poetry",
- ]
-
-
-def test_metadata_homepage_default():
- builder = Builder(
- Factory().create_poetry(Path(__file__).parent / "fixtures" / "simple_version"),
- NullEnv(),
- NullIO(),
- )
-
- metadata = Parser().parsestr(builder.get_metadata_content())
-
- assert metadata["Home-page"] is None
-
-
-def test_metadata_with_vcs_dependencies():
- builder = Builder(
- Factory().create_poetry(
- Path(__file__).parent / "fixtures" / "with_vcs_dependency"
- ),
- NullEnv(),
- NullIO(),
- )
-
- metadata = Parser().parsestr(builder.get_metadata_content())
-
- requires_dist = metadata["Requires-Dist"]
-
- assert "cleo @ git+https://github.com/sdispater/cleo.git@master" == requires_dist
-
-
-def test_metadata_with_url_dependencies():
- builder = Builder(
- Factory().create_poetry(
- Path(__file__).parent / "fixtures" / "with_url_dependency"
- ),
- NullEnv(),
- NullIO(),
- )
-
- metadata = Parser().parsestr(builder.get_metadata_content())
-
- requires_dist = metadata["Requires-Dist"]
-
- assert (
- "demo @ https://python-poetry.org/distributions/demo-0.1.0-py2.py3-none-any.whl"
- == requires_dist
- )
diff --git a/tests/masonry/builders/test_complete.py b/tests/masonry/builders/test_complete.py
deleted file mode 100644
index 2f3b4b2db09..00000000000
--- a/tests/masonry/builders/test_complete.py
+++ /dev/null
@@ -1,481 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-import ast
-import os
-import re
-import shutil
-import sys
-import tarfile
-import tempfile
-import zipfile
-
-import pytest
-
-from clikit.io import NullIO
-
-from poetry import __version__
-from poetry.factory import Factory
-from poetry.masonry.builders import CompleteBuilder
-from poetry.utils._compat import Path
-from poetry.utils._compat import decode
-from poetry.utils.env import NullEnv
-
-
-fixtures_dir = Path(__file__).parent / "fixtures"
-
-
-@pytest.fixture(autouse=True)
-def setup():
- clear_samples_dist()
-
- yield
-
- clear_samples_dist()
-
-
-def clear_samples_dist():
- for dist in fixtures_dir.glob("**/dist"):
- if dist.is_dir():
- shutil.rmtree(str(dist))
-
-
-@pytest.mark.skipif(
- sys.platform == "win32" and sys.version_info <= (3, 6),
- reason="Disable test on Windows for Python <=3.6",
-)
-def test_wheel_c_extension():
- module_path = fixtures_dir / "extended"
- builder = CompleteBuilder(
- Factory().create_poetry(module_path), NullEnv(execute=True), NullIO()
- )
- builder.build()
-
- sdist = fixtures_dir / "extended" / "dist" / "extended-0.1.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- assert "extended-0.1/build.py" in tar.getnames()
- assert "extended-0.1/extended/extended.c" in tar.getnames()
-
- whl = list((module_path / "dist").glob("extended-0.1-cp*-cp*-*.whl"))[0]
-
- assert whl.exists()
-
- zip = zipfile.ZipFile(str(whl))
-
- has_compiled_extension = False
- for name in zip.namelist():
- if name.startswith("extended/extended") and name.endswith((".so", ".pyd")):
- has_compiled_extension = True
-
- assert has_compiled_extension
-
- try:
- wheel_data = decode(zip.read("extended-0.1.dist-info/WHEEL"))
-
- assert (
- re.match(
- """(?m)^\
-Wheel-Version: 1.0
-Generator: poetry {}
-Root-Is-Purelib: false
-Tag: cp[23]\\d-cp[23]\\dm?u?-.+
-$""".format(
- __version__
- ),
- wheel_data,
- )
- is not None
- )
-
- records = decode(zip.read("extended-0.1.dist-info/RECORD"))
-
- assert re.search(r"\s+extended/extended.*\.(so|pyd)", records) is not None
- finally:
- zip.close()
-
-
-@pytest.mark.skipif(
- sys.platform == "win32" and sys.version_info <= (3, 6),
- reason="Disable test on Windows for Python <=3.6",
-)
-def test_wheel_c_extension_src_layout():
- module_path = fixtures_dir / "src_extended"
- builder = CompleteBuilder(
- Factory().create_poetry(module_path), NullEnv(execute=True), NullIO()
- )
- builder.build()
-
- sdist = fixtures_dir / "src_extended" / "dist" / "extended-0.1.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- assert "extended-0.1/build.py" in tar.getnames()
- assert "extended-0.1/src/extended/extended.c" in tar.getnames()
-
- whl = list((module_path / "dist").glob("extended-0.1-cp*-cp*-*.whl"))[0]
-
- assert whl.exists()
-
- zip = zipfile.ZipFile(str(whl))
-
- has_compiled_extension = False
- for name in zip.namelist():
- if name.startswith("extended/extended") and name.endswith((".so", ".pyd")):
- has_compiled_extension = True
-
- assert has_compiled_extension
-
- try:
- wheel_data = decode(zip.read("extended-0.1.dist-info/WHEEL"))
-
- assert (
- re.match(
- """(?m)^\
-Wheel-Version: 1.0
-Generator: poetry {}
-Root-Is-Purelib: false
-Tag: cp[23]\\d-cp[23]\\dm?u?-.+
-$""".format(
- __version__
- ),
- wheel_data,
- )
- is not None
- )
-
- records = decode(zip.read("extended-0.1.dist-info/RECORD"))
-
- assert re.search(r"\s+extended/extended.*\.(so|pyd)", records) is not None
- finally:
- zip.close()
-
-
-def test_complete():
- module_path = fixtures_dir / "complete"
- builder = CompleteBuilder(
- Factory().create_poetry(module_path), NullEnv(execute=True), NullIO()
- )
- builder.build()
-
- whl = module_path / "dist" / "my_package-1.2.3-py3-none-any.whl"
-
- assert whl.exists()
- if sys.platform != "win32":
- assert (os.stat(str(whl)).st_mode & 0o777) == 0o644
-
- zip = zipfile.ZipFile(str(whl))
-
- try:
- assert "my_package/sub_pgk1/extra_file.xml" not in zip.namelist()
-
- entry_points = zip.read("my_package-1.2.3.dist-info/entry_points.txt")
-
- assert (
- decode(entry_points.decode())
- == """\
-[console_scripts]
-extra-script=my_package.extra:main[time]
-my-2nd-script=my_package:main2
-my-script=my_package:main
-
-"""
- )
- wheel_data = decode(zip.read("my_package-1.2.3.dist-info/WHEEL"))
-
- assert (
- wheel_data
- == """\
-Wheel-Version: 1.0
-Generator: poetry {}
-Root-Is-Purelib: true
-Tag: py3-none-any
-""".format(
- __version__
- )
- )
- wheel_data = decode(zip.read("my_package-1.2.3.dist-info/METADATA"))
-
- assert (
- wheel_data
- == """\
-Metadata-Version: 2.1
-Name: my-package
-Version: 1.2.3
-Summary: Some description.
-Home-page: https://python-poetry.org/
-License: MIT
-Keywords: packaging,dependency,poetry
-Author: Sébastien Eustace
-Author-email: sebastien@eustace.io
-Maintainer: People Everywhere
-Maintainer-email: people@everywhere.com
-Requires-Python: >=3.6,<4.0
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.6
-Classifier: Programming Language :: Python :: 3.7
-Classifier: Programming Language :: Python :: 3.8
-Classifier: Topic :: Software Development :: Build Tools
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Provides-Extra: time
-Requires-Dist: cachy[msgpack] (>=0.2.0,<0.3.0)
-Requires-Dist: cleo (>=0.6,<0.7)
-Requires-Dist: pendulum (>=1.4,<2.0); (python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5") and (extra == "time")
-Project-URL: Documentation, https://python-poetry.org/docs
-Project-URL: Issue Tracker, https://github.com/python-poetry/poetry/issues
-Project-URL: Repository, https://github.com/python-poetry/poetry
-Description-Content-Type: text/x-rst
-
-My Package
-==========
-
-"""
- )
- finally:
- zip.close()
-
-
-def test_complete_no_vcs():
- # Copy the complete fixtures dir to a temporary directory
- module_path = fixtures_dir / "complete"
- temporary_dir = Path(tempfile.mkdtemp()) / "complete"
-
- shutil.copytree(module_path.as_posix(), temporary_dir.as_posix())
-
- builder = CompleteBuilder(
- Factory().create_poetry(temporary_dir), NullEnv(execute=True), NullIO()
- )
- builder.build()
-
- whl = temporary_dir / "dist" / "my_package-1.2.3-py3-none-any.whl"
-
- assert whl.exists()
-
- zip = zipfile.ZipFile(str(whl))
-
- # Check the zipped file to be sure that included and excluded files are
- # correctly taken account of without vcs
- expected_name_list = [
- "my_package/__init__.py",
- "my_package/data1/test.json",
- "my_package/sub_pkg1/__init__.py",
- "my_package/sub_pkg2/__init__.py",
- "my_package/sub_pkg2/data2/data.json",
- "my_package/sub_pkg3/foo.py",
- "my_package-1.2.3.dist-info/entry_points.txt",
- "my_package-1.2.3.dist-info/LICENSE",
- "my_package-1.2.3.dist-info/WHEEL",
- "my_package-1.2.3.dist-info/METADATA",
- "my_package-1.2.3.dist-info/RECORD",
- ]
-
- assert sorted(zip.namelist()) == sorted(expected_name_list)
-
- try:
- entry_points = zip.read("my_package-1.2.3.dist-info/entry_points.txt")
-
- assert (
- decode(entry_points.decode())
- == """\
-[console_scripts]
-extra-script=my_package.extra:main[time]
-my-2nd-script=my_package:main2
-my-script=my_package:main
-
-"""
- )
- wheel_data = decode(zip.read("my_package-1.2.3.dist-info/WHEEL"))
-
- assert (
- wheel_data
- == """\
-Wheel-Version: 1.0
-Generator: poetry {}
-Root-Is-Purelib: true
-Tag: py3-none-any
-""".format(
- __version__
- )
- )
- wheel_data = decode(zip.read("my_package-1.2.3.dist-info/METADATA"))
-
- assert (
- wheel_data
- == """\
-Metadata-Version: 2.1
-Name: my-package
-Version: 1.2.3
-Summary: Some description.
-Home-page: https://python-poetry.org/
-License: MIT
-Keywords: packaging,dependency,poetry
-Author: Sébastien Eustace
-Author-email: sebastien@eustace.io
-Maintainer: People Everywhere
-Maintainer-email: people@everywhere.com
-Requires-Python: >=3.6,<4.0
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.6
-Classifier: Programming Language :: Python :: 3.7
-Classifier: Programming Language :: Python :: 3.8
-Classifier: Topic :: Software Development :: Build Tools
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Provides-Extra: time
-Requires-Dist: cachy[msgpack] (>=0.2.0,<0.3.0)
-Requires-Dist: cleo (>=0.6,<0.7)
-Requires-Dist: pendulum (>=1.4,<2.0); (python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5") and (extra == "time")
-Project-URL: Documentation, https://python-poetry.org/docs
-Project-URL: Issue Tracker, https://github.com/python-poetry/poetry/issues
-Project-URL: Repository, https://github.com/python-poetry/poetry
-Description-Content-Type: text/x-rst
-
-My Package
-==========
-
-"""
- )
- finally:
- zip.close()
-
-
-def test_module_src():
- module_path = fixtures_dir / "source_file"
- builder = CompleteBuilder(
- Factory().create_poetry(module_path), NullEnv(execute=True), NullIO()
- )
- builder.build()
-
- sdist = module_path / "dist" / "module-src-0.1.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- assert "module-src-0.1/src/module_src.py" in tar.getnames()
-
- whl = module_path / "dist" / "module_src-0.1-py2.py3-none-any.whl"
-
- assert whl.exists()
-
- zip = zipfile.ZipFile(str(whl))
-
- try:
- assert "module_src.py" in zip.namelist()
- finally:
- zip.close()
-
-
-def test_package_src():
- module_path = fixtures_dir / "source_package"
- builder = CompleteBuilder(
- Factory().create_poetry(module_path), NullEnv(execute=True), NullIO()
- )
- builder.build()
-
- sdist = module_path / "dist" / "package-src-0.1.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- assert "package-src-0.1/src/package_src/module.py" in tar.getnames()
-
- whl = module_path / "dist" / "package_src-0.1-py2.py3-none-any.whl"
-
- assert whl.exists()
-
- zip = zipfile.ZipFile(str(whl))
-
- try:
- assert "package_src/__init__.py" in zip.namelist()
- assert "package_src/module.py" in zip.namelist()
- finally:
- zip.close()
-
-
-def test_package_with_include(mocker):
- module_path = fixtures_dir / "with-include"
-
- # Patch git module to return specific excluded files
- p = mocker.patch("poetry.vcs.git.Git.get_ignored_files")
- p.return_value = [
- str(
- Path(__file__).parent
- / "fixtures"
- / "with-include"
- / "extra_dir"
- / "vcs_excluded.txt"
- ),
- str(
- Path(__file__).parent
- / "fixtures"
- / "with-include"
- / "extra_dir"
- / "sub_pkg"
- / "vcs_excluded.txt"
- ),
- ]
- builder = CompleteBuilder(Factory().create_poetry(module_path), NullEnv(), NullIO())
- builder.build()
-
- sdist = fixtures_dir / "with-include" / "dist" / "with-include-1.2.3.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- names = tar.getnames()
- assert len(names) == len(set(names))
- assert "with-include-1.2.3/LICENSE" in names
- assert "with-include-1.2.3/README.rst" in names
- assert "with-include-1.2.3/extra_dir/__init__.py" in names
- assert "with-include-1.2.3/extra_dir/vcs_excluded.txt" in names
- assert "with-include-1.2.3/extra_dir/sub_pkg/__init__.py" in names
- assert "with-include-1.2.3/extra_dir/sub_pkg/vcs_excluded.txt" not in names
- assert "with-include-1.2.3/my_module.py" in names
- assert "with-include-1.2.3/notes.txt" in names
- assert "with-include-1.2.3/package_with_include/__init__.py" in names
- assert "with-include-1.2.3/tests/__init__.py" in names
- assert "with-include-1.2.3/pyproject.toml" in names
- assert "with-include-1.2.3/setup.py" in names
- assert "with-include-1.2.3/PKG-INFO" in names
- assert "with-include-1.2.3/for_wheel_only/__init__.py" not in names
- assert "with-include-1.2.3/src/src_package/__init__.py" in names
-
- setup = tar.extractfile("with-include-1.2.3/setup.py").read()
- setup_ast = ast.parse(setup)
-
- setup_ast.body = [n for n in setup_ast.body if isinstance(n, ast.Assign)]
- ns = {}
- exec(compile(setup_ast, filename="setup.py", mode="exec"), ns)
- assert ns["package_dir"] == {"": "src"}
- assert ns["packages"] == [
- "extra_dir",
- "extra_dir.sub_pkg",
- "package_with_include",
- "src_package",
- "tests",
- ]
- assert ns["package_data"] == {"": ["*"]}
- assert ns["modules"] == ["my_module"]
-
- whl = module_path / "dist" / "with_include-1.2.3-py3-none-any.whl"
-
- assert whl.exists()
-
- with zipfile.ZipFile(str(whl)) as z:
- names = z.namelist()
- assert len(names) == len(set(names))
- assert "with_include-1.2.3.dist-info/LICENSE" in names
- assert "extra_dir/__init__.py" in names
- assert "extra_dir/vcs_excluded.txt" in names
- assert "extra_dir/sub_pkg/__init__.py" in names
- assert "extra_dir/sub_pkg/vcs_excluded.txt" not in names
- assert "for_wheel_only/__init__.py" in names
- assert "my_module.py" in names
- assert "notes.txt" in names
- assert "package_with_include/__init__.py" in names
- assert "tests/__init__.py" not in names
- assert "src_package/__init__.py" in names
diff --git a/tests/masonry/builders/test_editable.py b/tests/masonry/builders/test_editable.py
deleted file mode 100644
index d1121243ca4..00000000000
--- a/tests/masonry/builders/test_editable.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-import sys
-
-from clikit.io import NullIO
-
-from poetry.factory import Factory
-from poetry.masonry.builders import EditableBuilder
-from poetry.utils._compat import Path
-from poetry.utils.env import MockEnv
-
-
-fixtures_dir = Path(__file__).parent / "fixtures"
-
-
-def test_build_should_delegate_to_pip_for_non_pure_python_packages(tmp_dir, mocker):
- move = mocker.patch("shutil.move")
- tmp_dir = Path(tmp_dir)
- env = MockEnv(path=tmp_dir, pip_version="18.1", execute=False, sys_path=[])
- module_path = fixtures_dir / "extended"
-
- builder = EditableBuilder(Factory().create_poetry(module_path), env, NullIO())
- builder.build()
-
- expected = [[sys.executable, "-m", "pip", "install", "-e", str(module_path)]]
- assert expected == env.executed
-
- assert 0 == move.call_count
-
-
-def test_build_should_temporarily_remove_the_pyproject_file(tmp_dir, mocker):
- move = mocker.patch("shutil.move")
- tmp_dir = Path(tmp_dir)
- env = MockEnv(path=tmp_dir, pip_version="19.1", execute=False, sys_path=[])
- module_path = fixtures_dir / "extended"
-
- builder = EditableBuilder(Factory().create_poetry(module_path), env, NullIO())
- builder.build()
-
- expected = [[sys.executable, "-m", "pip", "install", "-e", str(module_path)]]
- assert expected == env.executed
-
- assert 2 == move.call_count
-
- expected_calls = [
- mocker.call(
- str(module_path / "pyproject.toml"), str(module_path / "pyproject.tmp")
- ),
- mocker.call(
- str(module_path / "pyproject.tmp"), str(module_path / "pyproject.toml")
- ),
- ]
-
- assert expected_calls == move.call_args_list
diff --git a/tests/masonry/builders/test_sdist.py b/tests/masonry/builders/test_sdist.py
deleted file mode 100644
index ed2ded503df..00000000000
--- a/tests/masonry/builders/test_sdist.py
+++ /dev/null
@@ -1,490 +0,0 @@
-# -*- coding: utf-8 -*-
-import ast
-import shutil
-import tarfile
-
-from email.parser import Parser
-
-import pytest
-
-from clikit.io import NullIO
-
-from poetry.factory import Factory
-from poetry.masonry.builders.sdist import SdistBuilder
-from poetry.masonry.utils.package_include import PackageInclude
-from poetry.packages import Package
-from poetry.packages.vcs_dependency import VCSDependency
-from poetry.utils._compat import Path
-from poetry.utils._compat import to_str
-from poetry.utils.env import NullEnv
-from tests.helpers import get_dependency
-
-
-fixtures_dir = Path(__file__).parent / "fixtures"
-
-
-@pytest.fixture(autouse=True)
-def setup():
- clear_samples_dist()
-
- yield
-
- clear_samples_dist()
-
-
-def clear_samples_dist():
- for dist in fixtures_dir.glob("**/dist"):
- if dist.is_dir():
- shutil.rmtree(str(dist))
-
-
-def project(name):
- return Path(__file__).parent / "fixtures" / name
-
-
-def test_convert_dependencies():
- package = Package("foo", "1.2.3")
- result = SdistBuilder.convert_dependencies(
- package,
- [
- get_dependency("A", "^1.0"),
- get_dependency("B", "~1.0"),
- get_dependency("C", "1.2.3"),
- VCSDependency("D", "git", "https://github.com/sdispater/d.git"),
- ],
- )
- main = [
- "A>=1.0,<2.0",
- "B>=1.0,<1.1",
- "C==1.2.3",
- "D @ git+https://github.com/sdispater/d.git@master",
- ]
- extras = {}
-
- assert result == (main, extras)
-
- package = Package("foo", "1.2.3")
- package.extras = {"bar": [get_dependency("A")]}
-
- result = SdistBuilder.convert_dependencies(
- package,
- [
- get_dependency("A", ">=1.2", optional=True),
- get_dependency("B", "~1.0"),
- get_dependency("C", "1.2.3"),
- ],
- )
- main = ["B>=1.0,<1.1", "C==1.2.3"]
- extras = {"bar": ["A>=1.2"]}
-
- assert result == (main, extras)
-
- c = get_dependency("C", "1.2.3")
- c.python_versions = "~2.7 || ^3.6"
- d = get_dependency("D", "3.4.5", optional=True)
- d.python_versions = "~2.7 || ^3.4"
-
- package.extras = {"baz": [get_dependency("D")]}
-
- result = SdistBuilder.convert_dependencies(
- package,
- [
- get_dependency("A", ">=1.2", optional=True),
- get_dependency("B", "~1.0"),
- c,
- d,
- ],
- )
- main = ["B>=1.0,<1.1"]
-
- extra_python = (
- ':python_version >= "2.7" and python_version < "2.8" '
- 'or python_version >= "3.6" and python_version < "4.0"'
- )
- extra_d_dependency = (
- 'baz:python_version >= "2.7" and python_version < "2.8" '
- 'or python_version >= "3.4" and python_version < "4.0"'
- )
- extras = {extra_python: ["C==1.2.3"], extra_d_dependency: ["D==3.4.5"]}
-
- assert result == (main, extras)
-
-
-def test_make_setup():
- poetry = Factory().create_poetry(project("complete"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- setup = builder.build_setup()
- setup_ast = ast.parse(setup)
-
- setup_ast.body = [n for n in setup_ast.body if isinstance(n, ast.Assign)]
- ns = {}
- exec(compile(setup_ast, filename="setup.py", mode="exec"), ns)
- assert ns["packages"] == [
- "my_package",
- "my_package.sub_pkg1",
- "my_package.sub_pkg2",
- "my_package.sub_pkg3",
- ]
- assert ns["install_requires"] == ["cachy[msgpack]>=0.2.0,<0.3.0", "cleo>=0.6,<0.7"]
- assert ns["entry_points"] == {
- "console_scripts": [
- "extra-script = my_package.extra:main[time]",
- "my-2nd-script = my_package:main2",
- "my-script = my_package:main",
- ]
- }
- assert ns["extras_require"] == {
- 'time:python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5"': [
- "pendulum>=1.4,<2.0"
- ]
- }
-
-
-def test_make_pkg_info(mocker):
- get_metadata_content = mocker.patch(
- "poetry.masonry.builders.builder.Builder.get_metadata_content"
- )
- poetry = Factory().create_poetry(project("complete"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- builder.build_pkg_info()
-
- assert get_metadata_content.called
-
-
-def test_make_pkg_info_any_python():
- poetry = Factory().create_poetry(project("module1"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- pkg_info = builder.build_pkg_info()
- p = Parser()
- parsed = p.parsestr(to_str(pkg_info))
-
- assert "Requires-Python" not in parsed
-
-
-def test_find_files_to_add():
- poetry = Factory().create_poetry(project("complete"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- result = builder.find_files_to_add()
-
- assert sorted(result) == sorted(
- [
- Path("LICENSE"),
- Path("README.rst"),
- Path("my_package/__init__.py"),
- Path("my_package/data1/test.json"),
- Path("my_package/sub_pkg1/__init__.py"),
- Path("my_package/sub_pkg2/__init__.py"),
- Path("my_package/sub_pkg2/data2/data.json"),
- Path("my_package/sub_pkg3/foo.py"),
- Path("pyproject.toml"),
- ]
- )
-
-
-def test_make_pkg_info_multi_constraints_dependency():
- poetry = Factory().create_poetry(
- Path(__file__).parent.parent.parent
- / "fixtures"
- / "project_with_multi_constraints_dependency"
- )
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- pkg_info = builder.build_pkg_info()
- p = Parser()
- parsed = p.parsestr(to_str(pkg_info))
-
- requires = parsed.get_all("Requires-Dist")
- assert requires == [
- 'pendulum (>=1.5,<2.0); python_version < "3.4"',
- 'pendulum (>=2.0,<3.0); python_version >= "3.4" and python_version < "4.0"',
- ]
-
-
-def test_find_packages():
- poetry = Factory().create_poetry(project("complete"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
-
- base = project("complete")
- include = PackageInclude(base, "my_package")
-
- pkg_dir, packages, pkg_data = builder.find_packages(include)
-
- assert pkg_dir is None
- assert packages == [
- "my_package",
- "my_package.sub_pkg1",
- "my_package.sub_pkg2",
- "my_package.sub_pkg3",
- ]
- assert pkg_data == {
- "": ["*"],
- "my_package": ["data1/*"],
- "my_package.sub_pkg2": ["data2/*"],
- }
-
- poetry = Factory().create_poetry(project("source_package"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
-
- base = project("source_package")
- include = PackageInclude(base, "package_src", source="src")
-
- pkg_dir, packages, pkg_data = builder.find_packages(include)
-
- assert pkg_dir == str(base / "src")
- assert packages == ["package_src"]
- assert pkg_data == {"": ["*"]}
-
-
-def test_package():
- poetry = Factory().create_poetry(project("complete"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- builder.build()
-
- sdist = fixtures_dir / "complete" / "dist" / "my-package-1.2.3.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- assert "my-package-1.2.3/LICENSE" in tar.getnames()
-
-
-def test_module():
- poetry = Factory().create_poetry(project("module1"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- builder.build()
-
- sdist = fixtures_dir / "module1" / "dist" / "module1-0.1.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- assert "module1-0.1/module1.py" in tar.getnames()
-
-
-def test_prelease():
- poetry = Factory().create_poetry(project("prerelease"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- builder.build()
-
- sdist = fixtures_dir / "prerelease" / "dist" / "prerelease-0.1b1.tar.gz"
-
- assert sdist.exists()
-
-
-def test_with_c_extensions():
- poetry = Factory().create_poetry(project("extended"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- builder.build()
-
- sdist = fixtures_dir / "extended" / "dist" / "extended-0.1.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- assert "extended-0.1/build.py" in tar.getnames()
- assert "extended-0.1/extended/extended.c" in tar.getnames()
-
-
-def test_with_c_extensions_src_layout():
- poetry = Factory().create_poetry(project("src_extended"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- builder.build()
-
- sdist = fixtures_dir / "src_extended" / "dist" / "extended-0.1.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- assert "extended-0.1/build.py" in tar.getnames()
- assert "extended-0.1/src/extended/extended.c" in tar.getnames()
-
-
-def test_with_src_module_file():
- poetry = Factory().create_poetry(project("source_file"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
-
- # Check setup.py
- setup = builder.build_setup()
- setup_ast = ast.parse(setup)
-
- setup_ast.body = [n for n in setup_ast.body if isinstance(n, ast.Assign)]
- ns = {}
- exec(compile(setup_ast, filename="setup.py", mode="exec"), ns)
- assert ns["package_dir"] == {"": "src"}
- assert ns["modules"] == ["module_src"]
-
- builder.build()
-
- sdist = fixtures_dir / "source_file" / "dist" / "module-src-0.1.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- assert "module-src-0.1/src/module_src.py" in tar.getnames()
-
-
-def test_with_src_module_dir():
- poetry = Factory().create_poetry(project("source_package"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
-
- # Check setup.py
- setup = builder.build_setup()
- setup_ast = ast.parse(setup)
-
- setup_ast.body = [n for n in setup_ast.body if isinstance(n, ast.Assign)]
- ns = {}
- exec(compile(setup_ast, filename="setup.py", mode="exec"), ns)
- assert ns["package_dir"] == {"": "src"}
- assert ns["packages"] == ["package_src"]
-
- builder.build()
-
- sdist = fixtures_dir / "source_package" / "dist" / "package-src-0.1.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- assert "package-src-0.1/src/package_src/__init__.py" in tar.getnames()
- assert "package-src-0.1/src/package_src/module.py" in tar.getnames()
-
-
-def test_default_with_excluded_data(mocker):
- # Patch git module to return specific excluded files
- p = mocker.patch("poetry.vcs.git.Git.get_ignored_files")
- p.return_value = [
- (
- (
- Path(__file__).parent
- / "fixtures"
- / "default_with_excluded_data"
- / "my_package"
- / "data"
- / "sub_data"
- / "data2.txt"
- )
- .relative_to(project("default_with_excluded_data"))
- .as_posix()
- )
- ]
- poetry = Factory().create_poetry(project("default_with_excluded_data"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
-
- # Check setup.py
- setup = builder.build_setup()
- setup_ast = ast.parse(setup)
-
- setup_ast.body = [n for n in setup_ast.body if isinstance(n, ast.Assign)]
- ns = {}
- exec(compile(setup_ast, filename="setup.py", mode="exec"), ns)
- assert "package_dir" not in ns
- assert ns["packages"] == ["my_package"]
- assert ns["package_data"] == {
- "": ["*"],
- "my_package": ["data/*", "data/sub_data/data3.txt"],
- }
-
- builder.build()
-
- sdist = (
- fixtures_dir / "default_with_excluded_data" / "dist" / "my-package-1.2.3.tar.gz"
- )
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- names = tar.getnames()
- assert len(names) == len(set(names))
- assert "my-package-1.2.3/LICENSE" in names
- assert "my-package-1.2.3/README.rst" in names
- assert "my-package-1.2.3/my_package/__init__.py" in names
- assert "my-package-1.2.3/my_package/data/data1.txt" in names
- assert "my-package-1.2.3/pyproject.toml" in names
- assert "my-package-1.2.3/setup.py" in names
- assert "my-package-1.2.3/PKG-INFO" in names
- # all last modified times should be set to a valid timestamp
- for tarinfo in tar.getmembers():
- assert 0 < tarinfo.mtime
-
-
-def test_src_excluded_nested_data():
- module_path = fixtures_dir / "exclude_nested_data_toml"
- poetry = Factory().create_poetry(module_path)
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- builder.build()
-
- sdist = module_path / "dist" / "my-package-1.2.3.tar.gz"
-
- assert sdist.exists()
-
- with tarfile.open(str(sdist), "r") as tar:
- names = tar.getnames()
- assert len(names) == len(set(names))
- assert "my-package-1.2.3/LICENSE" in names
- assert "my-package-1.2.3/README.rst" in names
- assert "my-package-1.2.3/pyproject.toml" in names
- assert "my-package-1.2.3/setup.py" in names
- assert "my-package-1.2.3/PKG-INFO" in names
- assert "my-package-1.2.3/my_package/__init__.py" in names
- assert "my-package-1.2.3/my_package/data/sub_data/data2.txt" not in names
- assert "my-package-1.2.3/my_package/data/sub_data/data3.txt" not in names
- assert "my-package-1.2.3/my_package/data/data1.txt" not in names
- assert "my-package-1.2.3/my_package/data/data2.txt" in names
- assert "my-package-1.2.3/my_package/puplic/publicdata.txt" in names
- assert "my-package-1.2.3/my_package/public/item1/itemdata1.txt" not in names
- assert (
- "my-package-1.2.3/my_package/public/item1/subitem/subitemdata.txt"
- not in names
- )
- assert "my-package-1.2.3/my_package/public/item2/itemdata2.txt" not in names
-
-
-def test_proper_python_requires_if_two_digits_precision_version_specified():
- poetry = Factory().create_poetry(project("simple_version"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- pkg_info = builder.build_pkg_info()
- p = Parser()
- parsed = p.parsestr(to_str(pkg_info))
-
- assert parsed["Requires-Python"] == ">=3.6,<3.7"
-
-
-def test_proper_python_requires_if_three_digits_precision_version_specified():
- poetry = Factory().create_poetry(project("single_python"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- pkg_info = builder.build_pkg_info()
- p = Parser()
- parsed = p.parsestr(to_str(pkg_info))
-
- assert parsed["Requires-Python"] == "==2.7.15"
-
-
-def test_excluded_subpackage():
- poetry = Factory().create_poetry(project("excluded_subpackage"))
-
- builder = SdistBuilder(poetry, NullEnv(), NullIO())
- setup = builder.build_setup()
-
- setup_ast = ast.parse(setup)
-
- setup_ast.body = [n for n in setup_ast.body if isinstance(n, ast.Assign)]
- ns = {}
- exec(compile(setup_ast, filename="setup.py", mode="exec"), ns)
-
- assert ns["packages"] == ["example"]
diff --git a/tests/masonry/builders/test_wheel.py b/tests/masonry/builders/test_wheel.py
deleted file mode 100644
index ec3de8f7a60..00000000000
--- a/tests/masonry/builders/test_wheel.py
+++ /dev/null
@@ -1,164 +0,0 @@
-# -*- coding: utf-8 -*-
-import shutil
-import zipfile
-
-import pytest
-
-from clikit.io import NullIO
-
-from poetry.factory import Factory
-from poetry.masonry.builders.wheel import WheelBuilder
-from poetry.masonry.publishing.uploader import Uploader
-from poetry.utils._compat import Path
-from poetry.utils.env import NullEnv
-
-
-fixtures_dir = Path(__file__).parent / "fixtures"
-
-
-@pytest.fixture(autouse=True)
-def setup():
- clear_samples_dist()
-
- yield
-
- clear_samples_dist()
-
-
-def clear_samples_dist():
- for dist in fixtures_dir.glob("**/dist"):
- if dist.is_dir():
- shutil.rmtree(str(dist))
-
-
-def test_wheel_module():
- module_path = fixtures_dir / "module1"
- WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO())
-
- whl = module_path / "dist" / "module1-0.1-py2.py3-none-any.whl"
-
- assert whl.exists()
-
- with zipfile.ZipFile(str(whl)) as z:
- assert "module1.py" in z.namelist()
-
-
-def test_wheel_package():
- module_path = fixtures_dir / "complete"
- WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO())
-
- whl = module_path / "dist" / "my_package-1.2.3-py3-none-any.whl"
-
- assert whl.exists()
-
- with zipfile.ZipFile(str(whl)) as z:
- assert "my_package/sub_pkg1/__init__.py" in z.namelist()
-
-
-def test_wheel_prerelease():
- module_path = fixtures_dir / "prerelease"
- WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO())
-
- whl = module_path / "dist" / "prerelease-0.1b1-py2.py3-none-any.whl"
-
- assert whl.exists()
-
-
-def test_wheel_excluded_data():
- module_path = fixtures_dir / "default_with_excluded_data_toml"
- WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO())
-
- whl = module_path / "dist" / "my_package-1.2.3-py3-none-any.whl"
-
- assert whl.exists()
-
- with zipfile.ZipFile(str(whl)) as z:
- assert "my_package/__init__.py" in z.namelist()
- assert "my_package/data/sub_data/data2.txt" in z.namelist()
- assert "my_package/data/sub_data/data3.txt" in z.namelist()
- assert "my_package/data/data1.txt" not in z.namelist()
-
-
-def test_wheel_excluded_nested_data():
- module_path = fixtures_dir / "exclude_nested_data_toml"
- poetry = Factory().create_poetry(module_path)
- WheelBuilder.make(poetry, NullEnv(), NullIO())
-
- whl = module_path / "dist" / "my_package-1.2.3-py3-none-any.whl"
-
- assert whl.exists()
-
- with zipfile.ZipFile(str(whl)) as z:
- assert "my_package/__init__.py" in z.namelist()
- assert "my_package/data/sub_data/data2.txt" not in z.namelist()
- assert "my_package/data/sub_data/data3.txt" not in z.namelist()
- assert "my_package/data/data1.txt" not in z.namelist()
- assert "my_package/data/data2.txt" in z.namelist()
- assert "my_package/puplic/publicdata.txt" in z.namelist()
- assert "my_package/public/item1/itemdata1.txt" not in z.namelist()
- assert "my_package/public/item1/subitem/subitemdata.txt" not in z.namelist()
- assert "my_package/public/item2/itemdata2.txt" not in z.namelist()
-
-
-def test_wheel_localversionlabel():
- module_path = fixtures_dir / "localversionlabel"
- project = Factory().create_poetry(module_path)
- WheelBuilder.make(project, NullEnv(), NullIO())
- local_version_string = "localversionlabel-0.1b1+gitbranch.buildno.1"
- whl = module_path / "dist" / (local_version_string + "-py2.py3-none-any.whl")
-
- assert whl.exists()
-
- with zipfile.ZipFile(str(whl)) as z:
- assert local_version_string + ".dist-info/METADATA" in z.namelist()
-
- uploader = Uploader(project, NullIO())
- assert whl in uploader.files
-
-
-def test_wheel_package_src():
- module_path = fixtures_dir / "source_package"
- WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO())
-
- whl = module_path / "dist" / "package_src-0.1-py2.py3-none-any.whl"
-
- assert whl.exists()
-
- with zipfile.ZipFile(str(whl)) as z:
- assert "package_src/__init__.py" in z.namelist()
- assert "package_src/module.py" in z.namelist()
-
-
-def test_wheel_module_src():
- module_path = fixtures_dir / "source_file"
- WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO())
-
- whl = module_path / "dist" / "module_src-0.1-py2.py3-none-any.whl"
-
- assert whl.exists()
-
- with zipfile.ZipFile(str(whl)) as z:
- assert "module_src.py" in z.namelist()
-
-
-def test_dist_info_file_permissions():
- module_path = fixtures_dir / "complete"
- WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO())
-
- whl = module_path / "dist" / "my_package-1.2.3-py3-none-any.whl"
-
- with zipfile.ZipFile(str(whl)) as z:
- assert (
- z.getinfo("my_package-1.2.3.dist-info/WHEEL").external_attr == 0o644 << 16
- )
- assert (
- z.getinfo("my_package-1.2.3.dist-info/METADATA").external_attr
- == 0o644 << 16
- )
- assert (
- z.getinfo("my_package-1.2.3.dist-info/RECORD").external_attr == 0o644 << 16
- )
- assert (
- z.getinfo("my_package-1.2.3.dist-info/entry_points.txt").external_attr
- == 0o644 << 16
- )
diff --git a/tests/masonry/publishing/__init__.py b/tests/masonry/publishing/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/test_api.py b/tests/masonry/test_api.py
deleted file mode 100644
index 2019a08212a..00000000000
--- a/tests/masonry/test_api.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-import os
-import tarfile
-import zipfile
-
-from contextlib import contextmanager
-
-from poetry import __version__
-from poetry.masonry import api
-from poetry.utils._compat import Path
-from poetry.utils._compat import decode
-from poetry.utils.helpers import temporary_directory
-
-
-@contextmanager
-def cwd(directory):
- prev = os.getcwd()
- os.chdir(str(directory))
- try:
- yield
- finally:
- os.chdir(prev)
-
-
-fixtures = os.path.join(os.path.dirname(__file__), "builders", "fixtures")
-
-
-def test_get_requires_for_build_wheel():
- expected = []
- with cwd(os.path.join(fixtures, "complete")):
- assert api.get_requires_for_build_wheel() == expected
-
-
-def test_get_requires_for_build_sdist():
- expected = []
- with cwd(os.path.join(fixtures, "complete")):
- assert api.get_requires_for_build_sdist() == expected
-
-
-def test_build_wheel():
- with temporary_directory() as tmp_dir, cwd(os.path.join(fixtures, "complete")):
- filename = api.build_wheel(tmp_dir)
-
- with zipfile.ZipFile(str(os.path.join(tmp_dir, filename))) as zip:
- namelist = zip.namelist()
-
- assert "my_package-1.2.3.dist-info/entry_points.txt" in namelist
- assert "my_package-1.2.3.dist-info/WHEEL" in namelist
- assert "my_package-1.2.3.dist-info/METADATA" in namelist
-
-
-def test_build_sdist():
- with temporary_directory() as tmp_dir, cwd(os.path.join(fixtures, "complete")):
- filename = api.build_sdist(tmp_dir)
-
- with tarfile.open(str(os.path.join(tmp_dir, filename))) as tar:
- namelist = tar.getnames()
-
- assert "my-package-1.2.3/LICENSE" in namelist
-
-
-def test_prepare_metadata_for_build_wheel():
- entry_points = """\
-[console_scripts]
-extra-script=my_package.extra:main[time]
-my-2nd-script=my_package:main2
-my-script=my_package:main
-
-"""
- wheel_data = """\
-Wheel-Version: 1.0
-Generator: poetry {}
-Root-Is-Purelib: true
-Tag: py3-none-any
-""".format(
- __version__
- )
- metadata = """\
-Metadata-Version: 2.1
-Name: my-package
-Version: 1.2.3
-Summary: Some description.
-Home-page: https://python-poetry.org/
-License: MIT
-Keywords: packaging,dependency,poetry
-Author: Sébastien Eustace
-Author-email: sebastien@eustace.io
-Maintainer: People Everywhere
-Maintainer-email: people@everywhere.com
-Requires-Python: >=3.6,<4.0
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.6
-Classifier: Programming Language :: Python :: 3.7
-Classifier: Programming Language :: Python :: 3.8
-Classifier: Topic :: Software Development :: Build Tools
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Provides-Extra: time
-Requires-Dist: cachy[msgpack] (>=0.2.0,<0.3.0)
-Requires-Dist: cleo (>=0.6,<0.7)
-Requires-Dist: pendulum (>=1.4,<2.0); (python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5") and (extra == "time")
-Project-URL: Documentation, https://python-poetry.org/docs
-Project-URL: Issue Tracker, https://github.com/python-poetry/poetry/issues
-Project-URL: Repository, https://github.com/python-poetry/poetry
-Description-Content-Type: text/x-rst
-
-My Package
-==========
-
-"""
- with temporary_directory() as tmp_dir, cwd(os.path.join(fixtures, "complete")):
- dirname = api.prepare_metadata_for_build_wheel(tmp_dir)
-
- assert "my_package-1.2.3.dist-info" == dirname
-
- dist_info = Path(tmp_dir, dirname)
-
- assert (dist_info / "entry_points.txt").exists()
- assert (dist_info / "WHEEL").exists()
- assert (dist_info / "METADATA").exists()
-
- with (dist_info / "entry_points.txt").open(encoding="utf-8") as f:
- assert entry_points == decode(f.read())
-
- with (dist_info / "WHEEL").open(encoding="utf-8") as f:
- assert wheel_data == decode(f.read())
-
- with (dist_info / "METADATA").open(encoding="utf-8") as f:
- assert metadata == decode(f.read())
diff --git a/tests/masonry/utils/__init__.py b/tests/masonry/utils/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/utils/fixtures/with_includes/__init__.py b/tests/masonry/utils/fixtures/with_includes/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/utils/fixtures/with_includes/bar/baz.py b/tests/masonry/utils/fixtures/with_includes/bar/baz.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/utils/fixtures/with_includes/extra_package/some_dir/foo.py b/tests/masonry/utils/fixtures/with_includes/extra_package/some_dir/foo.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/utils/fixtures/with_includes/extra_package/some_dir/quux.py b/tests/masonry/utils/fixtures/with_includes/extra_package/some_dir/quux.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/utils/fixtures/with_includes/not_a_python_pkg/baz.txt b/tests/masonry/utils/fixtures/with_includes/not_a_python_pkg/baz.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/masonry/utils/test_package_include.py b/tests/masonry/utils/test_package_include.py
deleted file mode 100644
index a79ff96f03c..00000000000
--- a/tests/masonry/utils/test_package_include.py
+++ /dev/null
@@ -1,43 +0,0 @@
-import pytest
-
-from poetry.masonry.utils.package_include import PackageInclude
-from poetry.utils._compat import Path
-
-
-fixtures_dir = Path(__file__).parent / "fixtures"
-with_includes = fixtures_dir / "with_includes"
-
-
-def test_package_include_with_multiple_dirs():
- pkg_include = PackageInclude(base=fixtures_dir, include="with_includes")
- assert pkg_include.elements == [
- with_includes / "__init__.py",
- with_includes / "bar",
- with_includes / "bar/baz.py",
- with_includes / "extra_package",
- with_includes / "extra_package/some_dir",
- with_includes / "extra_package/some_dir/foo.py",
- with_includes / "extra_package/some_dir/quux.py",
- with_includes / "not_a_python_pkg",
- with_includes / "not_a_python_pkg/baz.txt",
- ]
-
-
-def test_package_include_with_simple_dir():
- pkg_include = PackageInclude(base=with_includes, include="bar")
- assert pkg_include.elements == [with_includes / "bar/baz.py"]
-
-
-def test_package_include_with_nested_dir():
- pkg_include = PackageInclude(base=with_includes, include="extra_package/**/*.py")
- assert pkg_include.elements == [
- with_includes / "extra_package/some_dir/foo.py",
- with_includes / "extra_package/some_dir/quux.py",
- ]
-
-
-def test_package_include_with_no_python_files_in_dir():
- with pytest.raises(ValueError) as e:
- PackageInclude(base=with_includes, include="not_a_python_pkg")
-
- assert str(e.value) == "not_a_python_pkg is not a package."
diff --git a/tests/mixology/helpers.py b/tests/mixology/helpers.py
index 1f9d686617a..05ab493f79a 100644
--- a/tests/mixology/helpers.py
+++ b/tests/mixology/helpers.py
@@ -1,7 +1,7 @@
+from poetry.core.packages import Package
from poetry.mixology.failure import SolveFailure
from poetry.mixology.version_solver import VersionSolver
from poetry.packages import DependencyPackage
-from poetry.packages import Package
def add_to_repo(repository, name, version, deps=None, python=None):
diff --git a/tests/mixology/version_solver/conftest.py b/tests/mixology/version_solver/conftest.py
index c27dfb11ff5..0b605d31f6b 100644
--- a/tests/mixology/version_solver/conftest.py
+++ b/tests/mixology/version_solver/conftest.py
@@ -2,7 +2,7 @@
from clikit.io import NullIO
-from poetry.packages.project_package import ProjectPackage
+from poetry.core.packages.project_package import ProjectPackage
from poetry.puzzle.provider import Provider
from poetry.repositories import Pool
from poetry.repositories import Repository
diff --git a/tests/packages/constraints/__init__.py b/tests/packages/constraints/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/packages/constraints/test_constraint.py b/tests/packages/constraints/test_constraint.py
deleted file mode 100644
index 1c55b63489e..00000000000
--- a/tests/packages/constraints/test_constraint.py
+++ /dev/null
@@ -1,90 +0,0 @@
-from poetry.packages.constraints.constraint import Constraint
-from poetry.packages.constraints.empty_constraint import EmptyConstraint
-from poetry.packages.constraints.multi_constraint import MultiConstraint
-from poetry.packages.constraints.union_constraint import UnionConstraint
-
-
-def test_allows():
- c = Constraint("win32")
-
- assert c.allows(Constraint("win32"))
- assert not c.allows(Constraint("linux"))
-
- c = Constraint("win32", "!=")
-
- assert not c.allows(Constraint("win32"))
- assert c.allows(Constraint("linux"))
-
-
-def test_allows_any():
- c = Constraint("win32")
-
- assert c.allows_any(Constraint("win32"))
- assert not c.allows_any(Constraint("linux"))
- assert c.allows_any(UnionConstraint(Constraint("win32"), Constraint("linux")))
- assert c.allows_any(Constraint("linux", "!="))
-
- c = Constraint("win32", "!=")
-
- assert not c.allows_any(Constraint("win32"))
- assert c.allows_any(Constraint("linux"))
- assert c.allows_any(UnionConstraint(Constraint("win32"), Constraint("linux")))
- assert c.allows_any(Constraint("linux", "!="))
-
-
-def test_allows_all():
- c = Constraint("win32")
-
- assert c.allows_all(Constraint("win32"))
- assert not c.allows_all(Constraint("linux"))
- assert not c.allows_all(Constraint("linux", "!="))
- assert not c.allows_all(UnionConstraint(Constraint("win32"), Constraint("linux")))
-
-
-def test_intersect():
- c = Constraint("win32")
-
- intersection = c.intersect(Constraint("linux"))
- assert intersection == EmptyConstraint()
-
- intersection = c.intersect(
- UnionConstraint(Constraint("win32"), Constraint("linux"))
- )
- assert intersection == Constraint("win32")
-
- intersection = c.intersect(
- UnionConstraint(Constraint("linux"), Constraint("linux2"))
- )
- assert intersection == EmptyConstraint()
-
- intersection = c.intersect(Constraint("linux", "!="))
- assert intersection == c
-
- c = Constraint("win32", "!=")
-
- intersection = c.intersect(Constraint("linux", "!="))
- assert intersection == MultiConstraint(
- Constraint("win32", "!="), Constraint("linux", "!=")
- )
-
-
-def test_union():
- c = Constraint("win32")
-
- union = c.union(Constraint("linux"))
- assert union == UnionConstraint(Constraint("win32"), Constraint("linux"))
-
- union = c.union(UnionConstraint(Constraint("win32"), Constraint("linux")))
- assert union == UnionConstraint(Constraint("win32"), Constraint("linux"))
-
- union = c.union(UnionConstraint(Constraint("linux"), Constraint("linux2")))
- assert union == UnionConstraint(
- Constraint("win32"), Constraint("linux"), Constraint("linux2")
- )
-
-
-def test_difference():
- c = Constraint("win32")
-
- assert c.difference(Constraint("win32")).is_empty()
- assert c.difference(Constraint("linux")) == c
diff --git a/tests/packages/constraints/test_main.py b/tests/packages/constraints/test_main.py
deleted file mode 100644
index 2b3418289b7..00000000000
--- a/tests/packages/constraints/test_main.py
+++ /dev/null
@@ -1,57 +0,0 @@
-import pytest
-
-from poetry.packages.constraints import parse_constraint
-from poetry.packages.constraints.any_constraint import AnyConstraint
-from poetry.packages.constraints.constraint import Constraint
-from poetry.packages.constraints.multi_constraint import MultiConstraint
-from poetry.packages.constraints.union_constraint import UnionConstraint
-
-
-@pytest.mark.parametrize(
- "input,constraint",
- [
- ("*", AnyConstraint()),
- ("win32", Constraint("win32", "=")),
- ("=win32", Constraint("win32", "=")),
- ("==win32", Constraint("win32", "=")),
- ("!=win32", Constraint("win32", "!=")),
- ("!= win32", Constraint("win32", "!=")),
- ],
-)
-def test_parse_constraint(input, constraint):
- assert parse_constraint(input) == constraint
-
-
-@pytest.mark.parametrize(
- "input,constraint",
- [
- (
- "!=win32,!=linux",
- MultiConstraint(Constraint("win32", "!="), Constraint("linux", "!=")),
- ),
- (
- "!=win32,!=linux,!=linux2",
- MultiConstraint(
- Constraint("win32", "!="),
- Constraint("linux", "!="),
- Constraint("linux2", "!="),
- ),
- ),
- ],
-)
-def test_parse_constraint_multi(input, constraint):
- assert parse_constraint(input) == constraint
-
-
-@pytest.mark.parametrize(
- "input,constraint",
- [
- ("win32 || linux", UnionConstraint(Constraint("win32"), Constraint("linux"))),
- (
- "win32 || !=linux2",
- UnionConstraint(Constraint("win32"), Constraint("linux2", "!=")),
- ),
- ],
-)
-def test_parse_constraint_union(input, constraint):
- assert parse_constraint(input) == constraint
diff --git a/tests/packages/constraints/test_multi_constraint.py b/tests/packages/constraints/test_multi_constraint.py
deleted file mode 100644
index 38f57fa902a..00000000000
--- a/tests/packages/constraints/test_multi_constraint.py
+++ /dev/null
@@ -1,41 +0,0 @@
-from poetry.packages.constraints.constraint import Constraint
-from poetry.packages.constraints.multi_constraint import MultiConstraint
-
-
-def test_allows():
- c = MultiConstraint(Constraint("win32", "!="), Constraint("linux", "!="))
-
- assert not c.allows(Constraint("win32"))
- assert not c.allows(Constraint("linux"))
- assert c.allows(Constraint("darwin"))
-
-
-def test_allows_any():
- c = MultiConstraint(Constraint("win32", "!="), Constraint("linux", "!="))
-
- assert c.allows_any(Constraint("darwin"))
- assert c.allows_any(Constraint("darwin", "!="))
- assert not c.allows_any(Constraint("win32"))
- assert c.allows_any(c)
- assert c.allows_any(
- MultiConstraint(Constraint("win32", "!="), Constraint("darwin", "!="))
- )
-
-
-def test_allows_all():
- c = MultiConstraint(Constraint("win32", "!="), Constraint("linux", "!="))
-
- assert c.allows_all(Constraint("darwin"))
- assert c.allows_all(Constraint("darwin", "!="))
- assert not c.allows_all(Constraint("win32"))
- assert c.allows_all(c)
- assert not c.allows_all(
- MultiConstraint(Constraint("win32", "!="), Constraint("darwin", "!="))
- )
-
-
-def test_intersect():
- c = MultiConstraint(Constraint("win32", "!="), Constraint("linux", "!="))
-
- intersection = c.intersect(Constraint("win32", "!="))
- assert intersection == Constraint("win32", "!=")
diff --git a/tests/packages/constraints/test_union_constraint.py b/tests/packages/constraints/test_union_constraint.py
deleted file mode 100644
index 2d6ad77185c..00000000000
--- a/tests/packages/constraints/test_union_constraint.py
+++ /dev/null
@@ -1,30 +0,0 @@
-from poetry.packages.constraints.constraint import Constraint
-from poetry.packages.constraints.union_constraint import UnionConstraint
-
-
-def test_allows():
- c = UnionConstraint(Constraint("win32"), Constraint("linux"))
-
- assert c.allows(Constraint("win32"))
- assert c.allows(Constraint("linux"))
- assert not c.allows(Constraint("darwin"))
-
-
-def test_allows_any():
- c = UnionConstraint(Constraint("win32"), Constraint("linux"))
-
- assert c.allows_any(c)
- assert c.allows_any(UnionConstraint(Constraint("win32"), Constraint("darwin")))
- assert not c.allows_any(UnionConstraint(Constraint("linux2"), Constraint("darwin")))
- assert c.allows_any(Constraint("win32"))
- assert not c.allows_any(Constraint("darwin"))
-
-
-def test_allows_all():
- c = UnionConstraint(Constraint("win32"), Constraint("linux"))
-
- assert c.allows_all(c)
- assert not c.allows_all(UnionConstraint(Constraint("win32"), Constraint("darwin")))
- assert not c.allows_all(UnionConstraint(Constraint("linux2"), Constraint("darwin")))
- assert c.allows_all(Constraint("win32"))
- assert not c.allows_all(Constraint("darwin"))
diff --git a/tests/packages/test_dependency.py b/tests/packages/test_dependency.py
deleted file mode 100644
index 91654f4b874..00000000000
--- a/tests/packages/test_dependency.py
+++ /dev/null
@@ -1,110 +0,0 @@
-from poetry.packages import Dependency
-from poetry.packages import Package
-
-
-def test_accepts():
- dependency = Dependency("A", "^1.0")
- package = Package("A", "1.4")
-
- assert dependency.accepts(package)
-
-
-def test_accepts_prerelease():
- dependency = Dependency("A", "^1.0", allows_prereleases=True)
- package = Package("A", "1.4-beta.1")
-
- assert dependency.accepts(package)
-
-
-def test_accepts_python_versions():
- dependency = Dependency("A", "^1.0")
- dependency.python_versions = "^3.6"
- package = Package("A", "1.4")
- package.python_versions = "~3.6"
-
- assert dependency.accepts(package)
-
-
-def test_accepts_fails_with_different_names():
- dependency = Dependency("A", "^1.0")
- package = Package("B", "1.4")
-
- assert not dependency.accepts(package)
-
-
-def test_accepts_fails_with_version_mismatch():
- dependency = Dependency("A", "~1.0")
- package = Package("B", "1.4")
-
- assert not dependency.accepts(package)
-
-
-def test_accepts_fails_with_prerelease_mismatch():
- dependency = Dependency("A", "^1.0")
- package = Package("B", "1.4-beta.1")
-
- assert not dependency.accepts(package)
-
-
-def test_accepts_fails_with_python_versions_mismatch():
- dependency = Dependency("A", "^1.0")
- dependency.python_versions = "^3.6"
- package = Package("B", "1.4")
- package.python_versions = "~3.5"
-
- assert not dependency.accepts(package)
-
-
-def test_to_pep_508():
- dependency = Dependency("Django", "^1.23")
-
- result = dependency.to_pep_508()
- assert result == "Django (>=1.23,<2.0)"
-
- dependency = Dependency("Django", "^1.23")
- dependency.python_versions = "~2.7 || ^3.6"
-
- result = dependency.to_pep_508()
- assert (
- result == "Django (>=1.23,<2.0); "
- 'python_version >= "2.7" and python_version < "2.8" '
- 'or python_version >= "3.6" and python_version < "4.0"'
- )
-
-
-def test_to_pep_508_wilcard():
- dependency = Dependency("Django", "*")
-
- result = dependency.to_pep_508()
- assert result == "Django"
-
-
-def test_to_pep_508_in_extras():
- dependency = Dependency("Django", "^1.23")
- dependency.in_extras.append("foo")
-
- result = dependency.to_pep_508()
- assert result == 'Django (>=1.23,<2.0); extra == "foo"'
-
- dependency.in_extras.append("bar")
-
- result = dependency.to_pep_508()
- assert result == 'Django (>=1.23,<2.0); extra == "foo" or extra == "bar"'
-
- dependency.python_versions = "~2.7 || ^3.6"
-
- result = dependency.to_pep_508()
- assert result == (
- "Django (>=1.23,<2.0); "
- "("
- 'python_version >= "2.7" and python_version < "2.8" '
- 'or python_version >= "3.6" and python_version < "4.0"'
- ") "
- 'and (extra == "foo" or extra == "bar")'
- )
-
-
-def test_to_pep_508_with_single_version_excluded():
- dependency = Dependency("foo", "!=1.2.3")
-
- assert "foo (!=1.2.3)" == dependency.to_pep_508()
diff --git a/tests/packages/test_directory_dependency.py b/tests/packages/test_directory_dependency.py
deleted file mode 100644
index a557bb8c060..00000000000
--- a/tests/packages/test_directory_dependency.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from subprocess import CalledProcessError
-
-import pytest
-
-from poetry.packages.directory_dependency import DirectoryDependency
-from poetry.utils._compat import Path
-from poetry.utils.env import EnvCommandError
-from poetry.utils.env import MockEnv as BaseMockEnv
-
-
-class MockEnv(BaseMockEnv):
- def run(self, bin, *args):
- raise EnvCommandError(CalledProcessError(1, "python", output=""))
-
-
-DIST_PATH = Path(__file__).parent.parent / "fixtures" / "git" / "github.com" / "demo"
-
-
-def test_directory_dependency_must_exist():
- with pytest.raises(ValueError):
- DirectoryDependency("demo", DIST_PATH / "invalid")
diff --git a/tests/packages/test_file_dependency.py b/tests/packages/test_file_dependency.py
deleted file mode 100644
index f5808d26641..00000000000
--- a/tests/packages/test_file_dependency.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import pytest
-
-from poetry.packages import FileDependency
-from poetry.utils._compat import Path
-
-
-DIST_PATH = Path(__file__).parent.parent / "fixtures" / "distributions"
-
-
-def test_file_dependency_wrong_path():
- with pytest.raises(ValueError):
- FileDependency("demo", DIST_PATH / "demo-0.2.0.tar.gz")
-
-
-def test_file_dependency_dir():
- with pytest.raises(ValueError):
- FileDependency("demo", DIST_PATH)
diff --git a/tests/packages/test_locker.py b/tests/packages/test_locker.py
index 2e166880612..7d41df3ca41 100644
--- a/tests/packages/test_locker.py
+++ b/tests/packages/test_locker.py
@@ -3,8 +3,8 @@
import pytest
import tomlkit
+from poetry.core.packages.project_package import ProjectPackage
from poetry.packages.locker import Locker
-from poetry.packages.project_package import ProjectPackage
from ..helpers import get_dependency
from ..helpers import get_package
diff --git a/tests/packages/test_main.py b/tests/packages/test_main.py
deleted file mode 100644
index 586be5a31b8..00000000000
--- a/tests/packages/test_main.py
+++ /dev/null
@@ -1,204 +0,0 @@
-from poetry.packages import dependency_from_pep_508
-
-
-def test_dependency_from_pep_508():
- name = "requests"
- dep = dependency_from_pep_508(name)
-
- assert dep.name == name
- assert str(dep.constraint) == "*"
-
-
-def test_dependency_from_pep_508_with_version():
- name = "requests==2.18.0"
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
-
-
-def test_dependency_from_pep_508_with_parens():
- name = "requests (==2.18.0)"
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
-
-
-def test_dependency_from_pep_508_with_constraint():
- name = "requests>=2.12.0,!=2.17.*,<3.0"
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == ">=2.12.0,<2.17.0 || >=2.18.0,<3.0"
-
-
-def test_dependency_from_pep_508_with_extras():
- name = 'requests==2.18.0; extra == "foo" or extra == "bar"'
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
- assert dep.in_extras == ["foo", "bar"]
- assert str(dep.marker) == 'extra == "foo" or extra == "bar"'
-
-
-def test_dependency_from_pep_508_with_python_version():
- name = 'requests (==2.18.0); python_version == "2.7" or python_version == "2.6"'
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
- assert dep.extras == []
- assert dep.python_versions == "~2.7 || ~2.6"
- assert str(dep.marker) == 'python_version == "2.7" or python_version == "2.6"'
-
-
-def test_dependency_from_pep_508_with_single_python_version():
- name = 'requests (==2.18.0); python_version == "2.7"'
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
- assert dep.extras == []
- assert dep.python_versions == "~2.7"
- assert str(dep.marker) == 'python_version == "2.7"'
-
-
-def test_dependency_from_pep_508_with_platform():
- name = 'requests (==2.18.0); sys_platform == "win32" or sys_platform == "darwin"'
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
- assert dep.extras == []
- assert dep.python_versions == "*"
- assert str(dep.marker) == 'sys_platform == "win32" or sys_platform == "darwin"'
-
-
-def test_dependency_from_pep_508_complex():
- name = (
- "requests (==2.18.0); "
- 'python_version >= "2.7" and python_version != "3.2" '
- 'and (sys_platform == "win32" or sys_platform == "darwin") '
- 'and extra == "foo"'
- )
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
- assert dep.in_extras == ["foo"]
- assert dep.python_versions == ">=2.7 !=3.2.*"
- assert str(dep.marker) == (
- 'python_version >= "2.7" and python_version != "3.2" '
- 'and (sys_platform == "win32" or sys_platform == "darwin") '
- 'and extra == "foo"'
- )
-
-
-def test_dependency_python_version_in():
- name = "requests (==2.18.0); python_version in '3.3 3.4 3.5'"
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
- assert dep.python_versions == "3.3.* || 3.4.* || 3.5.*"
- assert str(dep.marker) == 'python_version in "3.3 3.4 3.5"'
-
-
-def test_dependency_python_version_in_comma():
- name = "requests (==2.18.0); python_version in '3.3, 3.4, 3.5'"
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
- assert dep.python_versions == "3.3.* || 3.4.* || 3.5.*"
- assert str(dep.marker) == 'python_version in "3.3, 3.4, 3.5"'
-
-
-def test_dependency_platform_in():
- name = "requests (==2.18.0); sys_platform in 'win32 darwin'"
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
- assert str(dep.marker) == 'sys_platform in "win32 darwin"'
-
-
-def test_dependency_with_extra():
- name = "requests[security] (==2.18.0)"
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
-
- assert len(dep.extras) == 1
- assert dep.extras[0] == "security"
-
-
-def test_dependency_from_pep_508_with_python_version_union_of_multi():
- name = (
- "requests (==2.18.0); "
- '(python_version >= "2.7" and python_version < "2.8") '
- 'or (python_version >= "3.4" and python_version < "3.5")'
- )
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "requests"
- assert str(dep.constraint) == "2.18.0"
- assert dep.extras == []
- assert dep.python_versions == ">=2.7 <2.8 || >=3.4 <3.5"
- assert str(dep.marker) == (
- 'python_version >= "2.7" and python_version < "2.8" '
- 'or python_version >= "3.4" and python_version < "3.5"'
- )
-
-
-def test_dependency_from_pep_508_with_not_in_op_marker():
- name = (
- "jinja2 (>=2.7,<2.8)"
- '; python_version not in "3.0,3.1,3.2" and extra == "export"'
- )
-
- dep = dependency_from_pep_508(name)
-
- assert dep.name == "jinja2"
- assert str(dep.constraint) == ">=2.7,<2.8"
- assert dep.in_extras == ["export"]
- assert dep.python_versions == "!=3.0.*, !=3.1.*, !=3.2.*"
- assert (
- str(dep.marker) == 'python_version not in "3.0,3.1,3.2" and extra == "export"'
- )
-
-
-def test_dependency_from_pep_508_with_git_url():
- name = "django-utils @ git+ssh://git@corp-gitlab.com/corp-utils.git@1.2"
-
- dep = dependency_from_pep_508(name)
-
- assert "django-utils" == dep.name
- assert dep.is_vcs()
- assert "git" == dep.vcs
- assert "ssh://git@corp-gitlab.com/corp-utils.git" == dep.source
- assert "1.2" == dep.reference
-
-
-def test_dependency_from_pep_508_with_url():
- name = "django-utils @ https://example.com/django-utils-1.0.0.tar.gz"
-
- dep = dependency_from_pep_508(name)
-
- assert "django-utils" == dep.name
- assert dep.is_url()
- assert "https://example.com/django-utils-1.0.0.tar.gz" == dep.url
-
-
-def test_dependency_from_pep_508_with_wheel_url():
- name = (
- "example_wheel @ https://example.com/example_wheel-14.0.2-py2.py3-none-any.whl"
- )
-
- dep = dependency_from_pep_508(name)
-
- assert "example-wheel" == dep.name
- assert str(dep.constraint) == "14.0.2"
diff --git a/tests/packages/test_package.py b/tests/packages/test_package.py
deleted file mode 100644
index 510f542f222..00000000000
--- a/tests/packages/test_package.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-import pytest
-
-from poetry.packages import Package
-
-
-def test_package_authors():
- package = Package("foo", "0.1.0")
-
- package.authors.append("Sébastien Eustace ")
- assert package.author_name == "Sébastien Eustace"
- assert package.author_email == "sebastien@eustace.io"
-
- package.authors.insert(
- 0, "Raphaël Yancey "
- ) # With combining diacritics (ë = e + ¨ = e\u0308)
- assert package.author_name == "Raphaël Yancey" # Is normalized into \u00EB
- assert package.author_email == "raphael@badfile.net"
-
- package.authors.insert(
- 0, "Raphaël Yancey "
- ) # Without (ë = \u00EB)
- assert package.author_name == "Raphaël Yancey"
- assert package.author_email == "raphael@badfile.net"
-
- package.authors.insert(0, "John Doe")
- assert package.author_name == "John Doe"
- assert package.author_email is None
-
-
-@pytest.mark.parametrize("category", ["main", "dev"])
-def test_package_add_dependency_vcs_category(category):
- package = Package("foo", "0.1.0")
-
- dependency = package.add_dependency(
- "poetry",
- constraint={"git": "https://github.com/python-poetry/poetry.git"},
- category=category,
- )
- assert dependency.category == category
-
-
-def test_package_add_dependency_vcs_category_default_main():
- package = Package("foo", "0.1.0")
-
- dependency = package.add_dependency(
- "poetry", constraint={"git": "https://github.com/python-poetry/poetry.git"}
- )
- assert dependency.category == "main"
diff --git a/tests/packages/test_vcs_dependency.py b/tests/packages/test_vcs_dependency.py
deleted file mode 100644
index dc9847d3d3b..00000000000
--- a/tests/packages/test_vcs_dependency.py
+++ /dev/null
@@ -1,72 +0,0 @@
-import pytest
-
-from poetry.packages.vcs_dependency import VCSDependency
-
-
-def test_to_pep_508():
- dependency = VCSDependency(
- "poetry", "git", "https://github.com/python-poetry/poetry.git"
- )
-
- expected = "poetry @ git+https://github.com/python-poetry/poetry.git@master"
-
- assert expected == dependency.to_pep_508()
-
-
-def test_to_pep_508_ssh():
- dependency = VCSDependency("poetry", "git", "git@github.com:sdispater/poetry.git")
-
- expected = "poetry @ git+ssh://git@github.com/sdispater/poetry.git@master"
-
- assert expected == dependency.to_pep_508()
-
-
-def test_to_pep_508_with_extras():
- dependency = VCSDependency(
- "poetry", "git", "https://github.com/python-poetry/poetry.git"
- )
- dependency.extras.append("foo")
-
- expected = "poetry[foo] @ git+https://github.com/python-poetry/poetry.git@master"
-
- assert expected == dependency.to_pep_508()
-
-
-def test_to_pep_508_in_extras():
- dependency = VCSDependency(
- "poetry", "git", "https://github.com/python-poetry/poetry.git"
- )
- dependency.in_extras.append("foo")
-
- expected = 'poetry @ git+https://github.com/python-poetry/poetry.git@master ; extra == "foo"'
- assert expected == dependency.to_pep_508()
-
- dependency = VCSDependency(
- "poetry", "git", "https://github.com/python-poetry/poetry.git"
- )
- dependency.in_extras.append("foo")
- dependency.extras.append("bar")
-
- expected = 'poetry[bar] @ git+https://github.com/python-poetry/poetry.git@master ; extra == "foo"'
-
- assert expected == dependency.to_pep_508()
-
- dependency = VCSDependency(
- "poetry", "git", "https://github.com/python-poetry/poetry.git", "b;ar;"
- )
- dependency.in_extras.append("foo;")
-
- expected = 'poetry @ git+https://github.com/python-poetry/poetry.git@b;ar; ; extra == "foo;"'
-
- assert expected == dependency.to_pep_508()
-
-
-@pytest.mark.parametrize("category", ["main", "dev"])
-def test_category(category):
- dependency = VCSDependency(
- "poetry",
- "git",
- "https://github.com/python-poetry/poetry.git",
- category=category,
- )
- assert category == dependency.category
diff --git a/tests/packages/utils/__init__.py b/tests/packages/utils/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/packages/utils/test_utils.py b/tests/packages/utils/test_utils.py
deleted file mode 100644
index bf1abe262ba..00000000000
--- a/tests/packages/utils/test_utils.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from poetry.packages.utils.utils import convert_markers
-from poetry.version.markers import parse_marker
-
-
-def test_convert_markers():
- marker = parse_marker(
- 'sys_platform == "win32" and python_version < "3.6" '
- 'or sys_platform == "win32" and python_version < "3.6" and python_version >= "3.3" '
- 'or sys_platform == "win32" and python_version < "3.3"'
- )
-
- converted = convert_markers(marker)
-
- assert converted["python_version"] == [
- [("<", "3.6")],
- [("<", "3.6"), (">=", "3.3")],
- [("<", "3.3")],
- ]
-
- marker = parse_marker('python_version == "2.7" or python_version == "2.6"')
- converted = convert_markers(marker)
-
- assert converted["python_version"] == [[("==", "2.7")], [("==", "2.6")]]
diff --git a/tests/masonry/builders/fixtures/complete/my_package/sub_pkg2/__init__.py b/tests/publishing/__init__.py
similarity index 100%
rename from tests/masonry/builders/fixtures/complete/my_package/sub_pkg2/__init__.py
rename to tests/publishing/__init__.py
diff --git a/tests/masonry/publishing/test_publisher.py b/tests/publishing/test_publisher.py
similarity index 80%
rename from tests/masonry/publishing/test_publisher.py
rename to tests/publishing/test_publisher.py
index 18af37f1636..8ec4ac261b9 100644
--- a/tests/masonry/publishing/test_publisher.py
+++ b/tests/publishing/test_publisher.py
@@ -4,13 +4,13 @@
from poetry.factory import Factory
from poetry.io.null_io import NullIO
-from poetry.masonry.publishing.publisher import Publisher
+from poetry.publishing.publisher import Publisher
from poetry.utils._compat import Path
def test_publish_publishes_to_pypi_by_default(fixture_dir, mocker, config):
- uploader_auth = mocker.patch("poetry.masonry.publishing.uploader.Uploader.auth")
- uploader_upload = mocker.patch("poetry.masonry.publishing.uploader.Uploader.upload")
+ uploader_auth = mocker.patch("poetry.publishing.uploader.Uploader.auth")
+ uploader_upload = mocker.patch("poetry.publishing.uploader.Uploader.upload")
poetry = Factory().create_poetry(fixture_dir("sample_project"))
poetry._config = config
poetry.config.merge(
@@ -28,8 +28,8 @@ def test_publish_publishes_to_pypi_by_default(fixture_dir, mocker, config):
def test_publish_can_publish_to_given_repository(fixture_dir, mocker, config):
- uploader_auth = mocker.patch("poetry.masonry.publishing.uploader.Uploader.auth")
- uploader_upload = mocker.patch("poetry.masonry.publishing.uploader.Uploader.upload")
+ uploader_auth = mocker.patch("poetry.publishing.uploader.Uploader.auth")
+ uploader_upload = mocker.patch("poetry.publishing.uploader.Uploader.upload")
poetry = Factory().create_poetry(fixture_dir("sample_project"))
poetry._config = config
poetry.config.merge(
@@ -62,8 +62,8 @@ def test_publish_raises_error_for_undefined_repository(fixture_dir, mocker, conf
def test_publish_uses_token_if_it_exists(fixture_dir, mocker, config):
- uploader_auth = mocker.patch("poetry.masonry.publishing.uploader.Uploader.auth")
- uploader_upload = mocker.patch("poetry.masonry.publishing.uploader.Uploader.upload")
+ uploader_auth = mocker.patch("poetry.publishing.uploader.Uploader.auth")
+ uploader_upload = mocker.patch("poetry.publishing.uploader.Uploader.upload")
poetry = Factory().create_poetry(fixture_dir("sample_project"))
poetry._config = config
poetry.config.merge({"pypi-token": {"pypi": "my-token"}})
@@ -80,8 +80,8 @@ def test_publish_uses_token_if_it_exists(fixture_dir, mocker, config):
def test_publish_uses_cert(fixture_dir, mocker, config):
cert = "path/to/ca.pem"
- uploader_auth = mocker.patch("poetry.masonry.publishing.uploader.Uploader.auth")
- uploader_upload = mocker.patch("poetry.masonry.publishing.uploader.Uploader.upload")
+ uploader_auth = mocker.patch("poetry.publishing.uploader.Uploader.auth")
+ uploader_upload = mocker.patch("poetry.publishing.uploader.Uploader.upload")
poetry = Factory().create_poetry(fixture_dir("sample_project"))
poetry._config = config
poetry.config.merge(
@@ -104,7 +104,7 @@ def test_publish_uses_cert(fixture_dir, mocker, config):
def test_publish_uses_client_cert(fixture_dir, mocker, config):
client_cert = "path/to/client.pem"
- uploader_upload = mocker.patch("poetry.masonry.publishing.uploader.Uploader.upload")
+ uploader_upload = mocker.patch("poetry.publishing.uploader.Uploader.upload")
poetry = Factory().create_poetry(fixture_dir("sample_project"))
poetry._config = config
poetry.config.merge(
@@ -127,8 +127,8 @@ def test_publish_read_from_environment_variable(fixture_dir, environ, mocker, co
os.environ["POETRY_REPOSITORIES_FOO_URL"] = "https://foo.bar"
os.environ["POETRY_HTTP_BASIC_FOO_USERNAME"] = "bar"
os.environ["POETRY_HTTP_BASIC_FOO_PASSWORD"] = "baz"
- uploader_auth = mocker.patch("poetry.masonry.publishing.uploader.Uploader.auth")
- uploader_upload = mocker.patch("poetry.masonry.publishing.uploader.Uploader.upload")
+ uploader_auth = mocker.patch("poetry.publishing.uploader.Uploader.auth")
+ uploader_upload = mocker.patch("poetry.publishing.uploader.Uploader.upload")
poetry = Factory().create_poetry(fixture_dir("sample_project"))
publisher = Publisher(poetry, NullIO())
diff --git a/tests/masonry/publishing/test_uploader.py b/tests/publishing/test_uploader.py
similarity index 83%
rename from tests/masonry/publishing/test_uploader.py
rename to tests/publishing/test_uploader.py
index d99012dddb0..8c46057bf17 100644
--- a/tests/masonry/publishing/test_uploader.py
+++ b/tests/publishing/test_uploader.py
@@ -2,12 +2,12 @@
from poetry.factory import Factory
from poetry.io.null_io import NullIO
-from poetry.masonry.publishing.uploader import Uploader
-from poetry.masonry.publishing.uploader import UploadError
+from poetry.publishing.uploader import Uploader
+from poetry.publishing.uploader import UploadError
from poetry.utils._compat import Path
-fixtures_dir = Path(__file__).parent.parent.parent / "fixtures"
+fixtures_dir = Path(__file__).parent.parent / "fixtures"
def project(name):
@@ -35,7 +35,7 @@ def test_uploader_properly_handles_403_errors(http):
def test_uploader_registers_for_appropriate_400_errors(mocker, http):
- register = mocker.patch("poetry.masonry.publishing.uploader.Uploader._register")
+ register = mocker.patch("poetry.publishing.uploader.Uploader._register")
http.register_uri(
http.POST, "https://foo.com", status=400, body="No package was ever registered"
)
diff --git a/tests/puzzle/conftest.py b/tests/puzzle/conftest.py
index fc4d69c3078..e3812530bf5 100644
--- a/tests/puzzle/conftest.py
+++ b/tests/puzzle/conftest.py
@@ -30,9 +30,9 @@ def mock_clone(self, source, dest):
@pytest.fixture(autouse=True)
def setup(mocker):
# Patch git module to not actually clone projects
- mocker.patch("poetry.vcs.git.Git.clone", new=mock_clone)
- mocker.patch("poetry.vcs.git.Git.checkout", new=lambda *_: None)
- p = mocker.patch("poetry.vcs.git.Git.rev_parse")
+ mocker.patch("poetry.core.vcs.git.Git.clone", new=mock_clone)
+ mocker.patch("poetry.core.vcs.git.Git.checkout", new=lambda *_: None)
+ p = mocker.patch("poetry.core.vcs.git.Git.rev_parse")
p.return_value = "9cf87a285a2d3fbb0b9fa621997b3acc3631ed24"
yield
diff --git a/tests/puzzle/test_provider.py b/tests/puzzle/test_provider.py
index d3bcba65688..ebbd7a984d6 100644
--- a/tests/puzzle/test_provider.py
+++ b/tests/puzzle/test_provider.py
@@ -4,10 +4,10 @@
from clikit.io import NullIO
-from poetry.packages import ProjectPackage
-from poetry.packages.directory_dependency import DirectoryDependency
-from poetry.packages.file_dependency import FileDependency
-from poetry.packages.vcs_dependency import VCSDependency
+from poetry.core.packages import ProjectPackage
+from poetry.core.packages.directory_dependency import DirectoryDependency
+from poetry.core.packages.file_dependency import FileDependency
+from poetry.core.packages.vcs_dependency import VCSDependency
from poetry.puzzle.provider import Provider
from poetry.repositories.pool import Pool
from poetry.repositories.repository import Repository
diff --git a/tests/puzzle/test_solver.py b/tests/puzzle/test_solver.py
index 415f6bcea09..dd5fc98a331 100644
--- a/tests/puzzle/test_solver.py
+++ b/tests/puzzle/test_solver.py
@@ -2,15 +2,15 @@
from clikit.io import NullIO
-from poetry.packages import ProjectPackage
-from poetry.packages import dependency_from_pep_508
+from poetry.core.packages import ProjectPackage
+from poetry.core.packages import dependency_from_pep_508
+from poetry.core.version.markers import parse_marker
from poetry.puzzle import Solver
from poetry.puzzle.exceptions import SolverProblemError
from poetry.repositories.installed_repository import InstalledRepository
from poetry.repositories.pool import Pool
from poetry.repositories.repository import Repository
from poetry.utils._compat import Path
-from poetry.version.markers import parse_marker
from tests.helpers import get_dependency
from tests.helpers import get_package
from tests.repositories.test_legacy_repository import (
diff --git a/tests/repositories/test_installed_repository.py b/tests/repositories/test_installed_repository.py
index 727364bad1d..c35ad49df4a 100644
--- a/tests/repositories/test_installed_repository.py
+++ b/tests/repositories/test_installed_repository.py
@@ -32,19 +32,17 @@ def test_load(mocker):
return_value=INSTALLED_RESULTS,
)
mocker.patch(
- "poetry.vcs.git.Git.rev_parse",
+ "poetry.core.vcs.git.Git.rev_parse",
return_value="bb058f6b78b2d28ef5d9a5e759cfa179a1a713d6",
)
mocker.patch(
- "poetry.vcs.git.Git.remote_urls",
+ "poetry.core.vcs.git.Git.remote_urls",
side_effect=[
{"remote.origin.url": "https://github.com/sdispater/pendulum.git"},
{"remote.origin.url": "git@github.com:sdispater/pendulum.git"},
],
)
- mocker.patch(
- "poetry.repositories.installed_repository._CURRENT_VENDOR", str(VENDOR_DIR)
- )
+ mocker.patch("poetry.repositories.installed_repository._VENDORS", str(VENDOR_DIR))
repository = InstalledRepository.load(MockEnv(path=ENV_DIR))
assert len(repository.packages) == 3
diff --git a/tests/repositories/test_legacy_repository.py b/tests/repositories/test_legacy_repository.py
index 3803da552ce..7489947fee6 100644
--- a/tests/repositories/test_legacy_repository.py
+++ b/tests/repositories/test_legacy_repository.py
@@ -2,7 +2,7 @@
import pytest
-from poetry.packages import Dependency
+from poetry.core.packages import Dependency
from poetry.repositories.auth import Auth
from poetry.repositories.exceptions import PackageNotFound
from poetry.repositories.legacy_repository import LegacyRepository
diff --git a/tests/repositories/test_pypi_repository.py b/tests/repositories/test_pypi_repository.py
index f8a0f9336aa..be522bdb375 100644
--- a/tests/repositories/test_pypi_repository.py
+++ b/tests/repositories/test_pypi_repository.py
@@ -8,7 +8,7 @@
from requests.exceptions import TooManyRedirects
from requests.models import Response
-from poetry.packages import Dependency
+from poetry.core.packages import Dependency
from poetry.repositories.pypi_repository import PyPiRepository
from poetry.utils._compat import PY35
from poetry.utils._compat import Path
diff --git a/tests/semver/__init__.py b/tests/semver/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/semver/test_main.py b/tests/semver/test_main.py
deleted file mode 100644
index 4610e8d4573..00000000000
--- a/tests/semver/test_main.py
+++ /dev/null
@@ -1,200 +0,0 @@
-import pytest
-
-from poetry.semver import Version
-from poetry.semver import VersionRange
-from poetry.semver import VersionUnion
-from poetry.semver import parse_constraint
-
-
-@pytest.mark.parametrize(
- "input,constraint",
- [
- ("*", VersionRange()),
- ("*.*", VersionRange()),
- ("v*.*", VersionRange()),
- ("*.x.*", VersionRange()),
- ("x.X.x.*", VersionRange()),
- # ('!=1.0.0', Constraint('!=', '1.0.0.0')),
- (">1.0.0", VersionRange(min=Version(1, 0, 0))),
- ("<1.2.3", VersionRange(max=Version(1, 2, 3))),
- ("<=1.2.3", VersionRange(max=Version(1, 2, 3), include_max=True)),
- (">=1.2.3", VersionRange(min=Version(1, 2, 3), include_min=True)),
- ("=1.2.3", Version(1, 2, 3)),
- ("1.2.3", Version(1, 2, 3)),
- ("=1.0", Version(1, 0, 0)),
- ("1.2.3b5", Version(1, 2, 3, pre="b5")),
- (">= 1.2.3", VersionRange(min=Version(1, 2, 3), include_min=True)),
- (">dev", VersionRange(min=Version(0, 0, pre="dev"))), # Issue 206
- ],
-)
-def test_parse_constraint(input, constraint):
- assert parse_constraint(input) == constraint
-
-
-@pytest.mark.parametrize(
- "input,constraint",
- [
- ("v2.*", VersionRange(Version(2, 0, 0), Version(3, 0, 0), True)),
- ("2.*.*", VersionRange(Version(2, 0, 0), Version(3, 0, 0), True)),
- ("20.*", VersionRange(Version(20, 0, 0), Version(21, 0, 0), True)),
- ("20.*.*", VersionRange(Version(20, 0, 0), Version(21, 0, 0), True)),
- ("2.0.*", VersionRange(Version(2, 0, 0), Version(2, 1, 0), True)),
- ("2.x", VersionRange(Version(2, 0, 0), Version(3, 0, 0), True)),
- ("2.x.x", VersionRange(Version(2, 0, 0), Version(3, 0, 0), True)),
- ("2.2.X", VersionRange(Version(2, 2, 0), Version(2, 3, 0), True)),
- ("0.*", VersionRange(max=Version(1, 0, 0))),
- ("0.*.*", VersionRange(max=Version(1, 0, 0))),
- ("0.x", VersionRange(max=Version(1, 0, 0))),
- ],
-)
-def test_parse_constraint_wildcard(input, constraint):
- assert parse_constraint(input) == constraint
-
-
-@pytest.mark.parametrize(
- "input,constraint",
- [
- ("~v1", VersionRange(Version(1, 0, 0), Version(2, 0, 0), True)),
- ("~1.0", VersionRange(Version(1, 0, 0), Version(1, 1, 0), True)),
- ("~1.0.0", VersionRange(Version(1, 0, 0), Version(1, 1, 0), True)),
- ("~1.2", VersionRange(Version(1, 2, 0), Version(1, 3, 0), True)),
- ("~1.2.3", VersionRange(Version(1, 2, 3), Version(1, 3, 0), True)),
- (
- "~1.2-beta",
- VersionRange(Version(1, 2, 0, pre="beta"), Version(1, 3, 0), True),
- ),
- ("~1.2-b2", VersionRange(Version(1, 2, 0, pre="b2"), Version(1, 3, 0), True)),
- ("~0.3", VersionRange(Version(0, 3, 0), Version(0, 4, 0), True)),
- ("~3.5", VersionRange(Version(3, 5, 0), Version(3, 6, 0), True)),
- ("~=3.5", VersionRange(Version(3, 5, 0), Version(4, 0, 0), True)), # PEP 440
- ("~=3.5.3", VersionRange(Version(3, 5, 3), Version(3, 6, 0), True)), # PEP 440
- (
- "~=3.5.3rc1",
- VersionRange(Version(3, 5, 3, pre="rc1"), Version(3, 6, 0), True),
- ), # PEP 440
- ],
-)
-def test_parse_constraint_tilde(input, constraint):
- assert parse_constraint(input) == constraint
-
-
-@pytest.mark.parametrize(
- "input,constraint",
- [
- ("^v1", VersionRange(Version(1, 0, 0), Version(2, 0, 0), True)),
- ("^0", VersionRange(Version(0, 0, 0), Version(1, 0, 0), True)),
- ("^0.0", VersionRange(Version(0, 0, 0), Version(0, 1, 0), True)),
- ("^1.2", VersionRange(Version(1, 2, 0), Version(2, 0, 0), True)),
- (
- "^1.2.3-beta.2",
- VersionRange(Version(1, 2, 3, pre="beta.2"), Version(2, 0, 0), True),
- ),
- ("^1.2.3", VersionRange(Version(1, 2, 3), Version(2, 0, 0), True)),
- ("^0.2.3", VersionRange(Version(0, 2, 3), Version(0, 3, 0), True)),
- ("^0.2", VersionRange(Version(0, 2, 0), Version(0, 3, 0), True)),
- ("^0.2.0", VersionRange(Version(0, 2, 0), Version(0, 3, 0), True)),
- ("^0.0.3", VersionRange(Version(0, 0, 3), Version(0, 0, 4), True)),
- ],
-)
-def test_parse_constraint_caret(input, constraint):
- assert parse_constraint(input) == constraint
-
-
-@pytest.mark.parametrize(
- "input",
- [
- ">2.0,<=3.0",
- ">2.0 <=3.0",
- ">2.0 <=3.0",
- ">2.0, <=3.0",
- ">2.0 ,<=3.0",
- ">2.0 , <=3.0",
- ">2.0 , <=3.0",
- "> 2.0 <= 3.0",
- "> 2.0 , <= 3.0",
- " > 2.0 , <= 3.0 ",
- ],
-)
-def test_parse_constraint_multi(input):
- assert parse_constraint(input) == VersionRange(
- Version(2, 0, 0), Version(3, 0, 0), include_min=False, include_max=True
- )
-
-
-@pytest.mark.parametrize(
- "input",
- [">=2.7,!=3.0.*,!=3.1.*", ">=2.7, !=3.0.*, !=3.1.*", ">= 2.7, != 3.0.*, != 3.1.*"],
-)
-def test_parse_constraint_multi_wilcard(input):
- assert parse_constraint(input) == VersionUnion(
- VersionRange(Version(2, 7, 0), Version(3, 0, 0), True, False),
- VersionRange(Version(3, 2, 0), None, True, False),
- )
-
-
-@pytest.mark.parametrize(
- "input,constraint",
- [
- (
- "!=v2.*",
- VersionRange(max=Version.parse("2.0")).union(
- VersionRange(Version.parse("3.0"), include_min=True)
- ),
- ),
- (
- "!=2.*.*",
- VersionRange(max=Version.parse("2.0")).union(
- VersionRange(Version.parse("3.0"), include_min=True)
- ),
- ),
- (
- "!=2.0.*",
- VersionRange(max=Version.parse("2.0")).union(
- VersionRange(Version.parse("2.1"), include_min=True)
- ),
- ),
- ("!=0.*", VersionRange(Version.parse("1.0"), include_min=True)),
- ("!=0.*.*", VersionRange(Version.parse("1.0"), include_min=True)),
- ],
-)
-def test_parse_constraints_negative_wildcard(input, constraint):
- assert parse_constraint(input) == constraint
-
-
-@pytest.mark.parametrize(
- "input, expected",
- [
- ("1", "1"),
- ("1.2", "1.2"),
- ("1.2.3", "1.2.3"),
- ("!=1", "!=1"),
- ("!=1.2", "!=1.2"),
- ("!=1.2.3", "!=1.2.3"),
- ("^1", ">=1,<2"),
- ("^1.0", ">=1.0,<2.0"),
- ("^1.0.0", ">=1.0.0,<2.0.0"),
- ("~1", ">=1,<2"),
- ("~1.0", ">=1.0,<1.1"),
- ("~1.0.0", ">=1.0.0,<1.1.0"),
- ],
-)
-def test_constraints_keep_version_precision(input, expected):
- assert str(parse_constraint(input)) == expected
-
-
-@pytest.mark.parametrize(
- "unsorted, sorted_",
- [
- (["1.0.3", "1.0.2", "1.0.1"], ["1.0.1", "1.0.2", "1.0.3"]),
- (["1.0.0.2", "1.0.0.0rc2"], ["1.0.0.0rc2", "1.0.0.2"]),
- (["1.0.0.0", "1.0.0.0rc2"], ["1.0.0.0rc2", "1.0.0.0"]),
- (["1.0.0.0.0", "1.0.0.0rc2"], ["1.0.0.0rc2", "1.0.0.0.0"]),
- (["1.0.0rc2", "1.0.0rc1"], ["1.0.0rc1", "1.0.0rc2"]),
- (["1.0.0rc2", "1.0.0b1"], ["1.0.0b1", "1.0.0rc2"]),
- ],
-)
-def test_versions_are_sortable(unsorted, sorted_):
- unsorted = [parse_constraint(u) for u in unsorted]
- sorted_ = [parse_constraint(s) for s in sorted_]
-
- assert sorted(unsorted) == sorted_
diff --git a/tests/semver/test_version.py b/tests/semver/test_version.py
deleted file mode 100644
index b05167dd5dd..00000000000
--- a/tests/semver/test_version.py
+++ /dev/null
@@ -1,165 +0,0 @@
-import pytest
-
-from poetry.semver import EmptyConstraint
-from poetry.semver import Version
-from poetry.semver import VersionRange
-from poetry.semver.exceptions import ParseVersionError
-
-
-@pytest.mark.parametrize(
- "input,version",
- [
- ("1.0.0", Version(1, 0, 0)),
- ("1", Version(1, 0, 0)),
- ("1.0", Version(1, 0, 0)),
- ("1b1", Version(1, 0, 0, pre="beta1")),
- ("1.0b1", Version(1, 0, 0, pre="beta1")),
- ("1.0.0b1", Version(1, 0, 0, pre="beta1")),
- ("1.0.0-b1", Version(1, 0, 0, pre="beta1")),
- ("1.0.0-beta.1", Version(1, 0, 0, pre="beta1")),
- ("1.0.0+1", Version(1, 0, 0, build="1")),
- ("1.0.0-1", Version(1, 0, 0, build="1")),
- ("1.0.0.0", Version(1, 0, 0)),
- ("1.0.0-post", Version(1, 0, 0)),
- ("1.0.0-post1", Version(1, 0, 0, build="1")),
- ("0.6c", Version(0, 6, 0, pre="rc0")),
- ("0.6pre", Version(0, 6, 0, pre="rc0")),
- ],
-)
-def test_parse_valid(input, version):
- parsed = Version.parse(input)
-
- assert parsed == version
- assert parsed.text == input
-
-
-@pytest.mark.parametrize("input", [(None, "example")])
-def test_parse_invalid(input):
- with pytest.raises(ParseVersionError):
- Version.parse(input)
-
-
-def test_comparison():
- versions = [
- "1.0.0-alpha",
- "1.0.0-alpha.1",
- "1.0.0-beta.2",
- "1.0.0-beta.11",
- "1.0.0-rc.1",
- "1.0.0-rc.1+build.1",
- "1.0.0",
- "1.0.0+0.3.7",
- "1.3.7+build",
- "1.3.7+build.2.b8f12d7",
- "1.3.7+build.11.e0f985a",
- "2.0.0",
- "2.1.0",
- "2.2.0",
- "2.11.0",
- "2.11.1",
- ]
-
- for i in range(len(versions)):
- for j in range(len(versions)):
- a = Version.parse(versions[i])
- b = Version.parse(versions[j])
-
- assert (a < b) == (i < j)
- assert (a > b) == (i > j)
- assert (a <= b) == (i <= j)
- assert (a >= b) == (i >= j)
- assert (a == b) == (i == j)
- assert (a != b) == (i != j)
-
-
-def test_equality():
- assert Version.parse("1.2.3") == Version.parse("01.2.3")
- assert Version.parse("1.2.3") == Version.parse("1.02.3")
- assert Version.parse("1.2.3") == Version.parse("1.2.03")
- assert Version.parse("1.2.3-1") == Version.parse("1.2.3-01")
- assert Version.parse("1.2.3+1") == Version.parse("1.2.3+01")
-
-
-def test_allows():
- v = Version.parse("1.2.3")
- assert v.allows(v)
- assert not v.allows(Version.parse("2.2.3"))
- assert not v.allows(Version.parse("1.3.3"))
- assert not v.allows(Version.parse("1.2.4"))
- assert not v.allows(Version.parse("1.2.3-dev"))
- assert not v.allows(Version.parse("1.2.3+build"))
-
-
-def test_allows_all():
- v = Version.parse("1.2.3")
-
- assert v.allows_all(v)
- assert not v.allows_all(Version.parse("0.0.3"))
- assert not v.allows_all(
- VersionRange(Version.parse("1.1.4"), Version.parse("1.2.4"))
- )
- assert not v.allows_all(VersionRange())
- assert v.allows_all(EmptyConstraint())
-
-
-def test_allows_any():
- v = Version.parse("1.2.3")
-
- assert v.allows_any(v)
- assert not v.allows_any(Version.parse("0.0.3"))
- assert v.allows_any(VersionRange(Version.parse("1.1.4"), Version.parse("1.2.4")))
- assert v.allows_any(VersionRange())
- assert not v.allows_any(EmptyConstraint())
-
-
-def test_intersect():
- v = Version.parse("1.2.3")
-
- assert v.intersect(v) == v
- assert v.intersect(Version.parse("1.1.4")).is_empty()
- assert (
- v.intersect(VersionRange(Version.parse("1.1.4"), Version.parse("1.2.4"))) == v
- )
- assert (
- Version.parse("1.1.4")
- .intersect(VersionRange(v, Version.parse("1.2.4")))
- .is_empty()
- )
-
-
-def test_union():
- v = Version.parse("1.2.3")
-
- assert v.union(v) == v
-
- result = v.union(Version.parse("0.8.0"))
- assert result.allows(v)
- assert result.allows(Version.parse("0.8.0"))
- assert not result.allows(Version.parse("1.1.4"))
-
- range = VersionRange(Version.parse("1.1.4"), Version.parse("1.2.4"))
- assert v.union(range) == range
-
- union = Version.parse("1.1.4").union(
- VersionRange(Version.parse("1.1.4"), Version.parse("1.2.4"))
- )
- assert union == VersionRange(
- Version.parse("1.1.4"), Version.parse("1.2.4"), include_min=True
- )
-
- result = v.union(VersionRange(Version.parse("0.0.3"), Version.parse("1.1.4")))
- assert result.allows(v)
- assert result.allows(Version.parse("0.1.0"))
-
-
-def test_difference():
- v = Version.parse("1.2.3")
-
- assert v.difference(v).is_empty()
- assert v.difference(Version.parse("0.8.0")) == v
- assert v.difference(
- VersionRange(Version.parse("1.1.4"), Version.parse("1.2.4"))
- ).is_empty()
- assert (
- v.difference(VersionRange(Version.parse("1.4.0"), Version.parse("3.0.0"))) == v
- )
diff --git a/tests/semver/test_version_range.py b/tests/semver/test_version_range.py
deleted file mode 100644
index fa5cde59be4..00000000000
--- a/tests/semver/test_version_range.py
+++ /dev/null
@@ -1,260 +0,0 @@
-import pytest
-
-from poetry.semver import EmptyConstraint
-from poetry.semver import Version
-from poetry.semver import VersionRange
-
-
-@pytest.fixture()
-def v003():
- return Version.parse("0.0.3")
-
-
-@pytest.fixture()
-def v010():
- return Version.parse("0.1.0")
-
-
-@pytest.fixture()
-def v080():
- return Version.parse("0.8.0")
-
-
-@pytest.fixture()
-def v072():
- return Version.parse("0.7.2")
-
-
-@pytest.fixture()
-def v114():
- return Version.parse("1.1.4")
-
-
-@pytest.fixture()
-def v123():
- return Version.parse("1.2.3")
-
-
-@pytest.fixture()
-def v124():
- return Version.parse("1.2.4")
-
-
-@pytest.fixture()
-def v130():
- return Version.parse("1.3.0")
-
-
-@pytest.fixture()
-def v140():
- return Version.parse("1.4.0")
-
-
-@pytest.fixture()
-def v200():
- return Version.parse("2.0.0")
-
-
-@pytest.fixture()
-def v234():
- return Version.parse("2.3.4")
-
-
-@pytest.fixture()
-def v250():
- return Version.parse("2.5.0")
-
-
-@pytest.fixture()
-def v300():
- return Version.parse("3.0.0")
-
-
-def test_allows_all(v003, v010, v080, v114, v123, v124, v140, v200, v234, v250, v300):
- assert VersionRange(v123, v250).allows_all(EmptyConstraint())
-
- range = VersionRange(v123, v250, include_max=True)
- assert not range.allows_all(v123)
- assert range.allows_all(v124)
- assert range.allows_all(v250)
- assert not range.allows_all(v300)
-
- # with no min
- range = VersionRange(max=v250)
- assert range.allows_all(VersionRange(v080, v140))
- assert not range.allows_all(VersionRange(v080, v300))
- assert range.allows_all(VersionRange(max=v140))
- assert not range.allows_all(VersionRange(max=v300))
- assert range.allows_all(range)
- assert not range.allows_all(VersionRange())
-
- # with no max
- range = VersionRange(min=v010)
- assert range.allows_all(VersionRange(v080, v140))
- assert not range.allows_all(VersionRange(v003, v140))
- assert range.allows_all(VersionRange(v080))
- assert not range.allows_all(VersionRange(v003))
- assert range.allows_all(range)
- assert not range.allows_all(VersionRange())
-
- # Allows bordering range that is not more inclusive
- exclusive = VersionRange(v010, v250)
- inclusive = VersionRange(v010, v250, True, True)
- assert inclusive.allows_all(exclusive)
- assert inclusive.allows_all(inclusive)
- assert not exclusive.allows_all(inclusive)
- assert exclusive.allows_all(exclusive)
-
- # Allows unions that are completely contained
- range = VersionRange(v114, v200)
- assert range.allows_all(VersionRange(v123, v124).union(v140))
- assert not range.allows_all(VersionRange(v010, v124).union(v140))
- assert not range.allows_all(VersionRange(v123, v234).union(v140))
-
-
-def test_allows_any(
- v003, v010, v072, v080, v114, v123, v124, v140, v200, v234, v250, v300
-):
- # disallows an empty constraint
- assert not VersionRange(v123, v250).allows_any(EmptyConstraint())
-
- # allows allowed versions
- range = VersionRange(v123, v250, include_max=True)
- assert not range.allows_any(v123)
- assert range.allows_any(v124)
- assert range.allows_any(v250)
- assert not range.allows_any(v300)
-
- # with no min
- range = VersionRange(max=v200)
- assert range.allows_any(VersionRange(v140, v300))
- assert not range.allows_any(VersionRange(v234, v300))
- assert range.allows_any(VersionRange(v140))
- assert not range.allows_any(VersionRange(v234))
- assert range.allows_any(range)
-
- # with no max
- range = VersionRange(min=v072)
- assert range.allows_any(VersionRange(v003, v140))
- assert not range.allows_any(VersionRange(v003, v010))
- assert range.allows_any(VersionRange(max=v080))
- assert not range.allows_any(VersionRange(max=v003))
- assert range.allows_any(range)
-
- # with min and max
- range = VersionRange(v072, v200)
- assert range.allows_any(VersionRange(v003, v140))
- assert range.allows_any(VersionRange(v140, v300))
- assert not range.allows_any(VersionRange(v003, v010))
- assert not range.allows_any(VersionRange(v234, v300))
- assert not range.allows_any(VersionRange(max=v010))
- assert not range.allows_any(VersionRange(v234))
- assert range.allows_any(range)
-
- # allows a bordering range when both are inclusive
- assert not VersionRange(max=v250).allows_any(VersionRange(min=v250))
- assert not VersionRange(max=v250, include_max=True).allows_any(
- VersionRange(min=v250)
- )
- assert not VersionRange(max=v250).allows_any(
- VersionRange(min=v250, include_min=True)
- )
- assert not VersionRange(min=v250).allows_any(VersionRange(max=v250))
- assert VersionRange(max=v250, include_max=True).allows_any(
- VersionRange(min=v250, include_min=True)
- )
-
- # allows unions that are partially contained'
- range = VersionRange(v114, v200)
- assert range.allows_any(VersionRange(v010, v080).union(v140))
- assert range.allows_any(VersionRange(v123, v234).union(v300))
- assert not range.allows_any(VersionRange(v234, v300).union(v010))
-
- # pre-release min does not allow lesser than itself
- range = VersionRange(Version.parse("1.9b1"), include_min=True)
- assert not range.allows_any(
- VersionRange(
- Version.parse("1.8.0"),
- Version.parse("1.9.0"),
- include_min=True,
- always_include_max_prerelease=True,
- )
- )
-
-
-def test_intersect(v114, v123, v124, v200, v250, v300):
- # two overlapping ranges
- assert VersionRange(v123, v250).intersect(VersionRange(v200, v300)) == VersionRange(
- v200, v250
- )
-
- # a non-overlapping range allows no versions
- a = VersionRange(v114, v124)
- b = VersionRange(v200, v250)
- assert a.intersect(b).is_empty()
-
- # adjacent ranges allow no versions if exclusive
- a = VersionRange(v114, v124)
- b = VersionRange(v124, v200)
- assert a.intersect(b).is_empty()
-
- # adjacent ranges allow version if inclusive
- a = VersionRange(v114, v124, include_max=True)
- b = VersionRange(v124, v200, include_min=True)
- assert a.intersect(b) == v124
-
- # with an open range
- open = VersionRange()
- a = VersionRange(v114, v124)
- assert open.intersect(open) == open
- assert open.intersect(a) == a
-
- # returns the version if the range allows it
- assert VersionRange(v114, v124).intersect(v123) == v123
- assert VersionRange(v123, v124).intersect(v114).is_empty()
-
-
-def test_union(
- v003, v010, v072, v080, v114, v123, v124, v130, v140, v200, v234, v250, v300
-):
- # with a version returns the range if it contains the version
- range = VersionRange(v114, v124)
- assert range.union(v123) == range
-
- # with a version on the edge of the range, expands the range
- range = VersionRange(v114, v124)
- assert range.union(v124) == VersionRange(v114, v124, include_max=True)
- assert range.union(v114) == VersionRange(v114, v124, include_min=True)
-
- # with a version allows both the range and the version if the range
- # doesn't contain the version
- result = VersionRange(v003, v114).union(v124)
- assert result.allows(v010)
- assert not result.allows(v123)
- assert result.allows(v124)
-
- # returns a VersionUnion for a disjoint range
- result = VersionRange(v003, v114).union(VersionRange(v130, v200))
- assert result.allows(v080)
- assert not result.allows(v123)
- assert result.allows(v140)
-
- # considers open ranges disjoint
- result = VersionRange(v003, v114).union(VersionRange(v114, v200))
- assert result.allows(v080)
- assert not result.allows(v114)
- assert result.allows(v140)
- result = VersionRange(v114, v200).union(VersionRange(v003, v114))
- assert result.allows(v080)
- assert not result.allows(v114)
- assert result.allows(v140)
-
- # returns a merged range for an overlapping range
- result = VersionRange(v003, v114).union(VersionRange(v080, v200))
- assert result == VersionRange(v003, v200)
-
- # considers closed ranges overlapping
- result = VersionRange(v003, v114, include_max=True).union(VersionRange(v114, v200))
- assert result == VersionRange(v003, v200)
- result = VersionRange(v003, v114).union(VersionRange(v114, v200, include_min=True))
- assert result == VersionRange(v003, v200)
diff --git a/tests/spdx/__init__.py b/tests/spdx/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/spdx/test_license.py b/tests/spdx/test_license.py
deleted file mode 100644
index 2589045063c..00000000000
--- a/tests/spdx/test_license.py
+++ /dev/null
@@ -1,50 +0,0 @@
-from poetry.spdx import license_by_id
-
-
-def test_classifier_name():
- license = license_by_id("lgpl-3.0-or-later")
-
- assert (
- license.classifier_name
- == "GNU Lesser General Public License v3 or later (LGPLv3+)"
- )
-
-
-def test_classifier_name_no_classifer_osi_approved():
- license = license_by_id("LiLiQ-R-1.1")
-
- assert license.classifier_name is None
-
-
-def test_classifier_name_no_classifer():
- license = license_by_id("Leptonica")
-
- assert license.classifier_name == "Other/Proprietary License"
-
-
-def test_classifier():
- license = license_by_id("lgpl-3.0-or-later")
-
- assert license.classifier == (
- "License :: "
- "OSI Approved :: "
- "GNU Lesser General Public License v3 or later (LGPLv3+)"
- )
-
-
-def test_classifier_no_classifer_osi_approved():
- license = license_by_id("LiLiQ-R-1.1")
-
- assert license.classifier == "License :: OSI Approved"
-
-
-def test_classifier_no_classifer():
- license = license_by_id("Leptonica")
-
- assert license.classifier == "License :: Other/Proprietary License"
-
-
-def test_proprietary_license():
- license = license_by_id("Proprietary")
-
- assert "License :: Other/Proprietary License" == license.classifier
diff --git a/tests/spdx/test_main.py b/tests/spdx/test_main.py
deleted file mode 100644
index 00e0910044d..00000000000
--- a/tests/spdx/test_main.py
+++ /dev/null
@@ -1,43 +0,0 @@
-import pytest
-
-from poetry.spdx import license_by_id
-
-
-def test_license_by_id():
- license = license_by_id("MIT")
-
- assert license.id == "MIT"
- assert license.name == "MIT License"
- assert license.is_osi_approved
- assert not license.is_deprecated
-
- license = license_by_id("LGPL-3.0-or-later")
-
- assert license.id == "LGPL-3.0-or-later"
- assert license.name == "GNU Lesser General Public License v3.0 or later"
- assert license.is_osi_approved
- assert not license.is_deprecated
-
-
-def test_license_by_id_is_case_insensitive():
- license = license_by_id("mit")
-
- assert license.id == "MIT"
-
- license = license_by_id("miT")
-
- assert license.id == "MIT"
-
-
-def test_license_by_id_with_full_name():
- license = license_by_id("GNU Lesser General Public License v3.0 or later")
-
- assert license.id == "LGPL-3.0-or-later"
- assert license.name == "GNU Lesser General Public License v3.0 or later"
- assert license.is_osi_approved
- assert not license.is_deprecated
-
-
-def test_license_by_id_invalid():
- with pytest.raises(ValueError):
- license_by_id("invalid")
diff --git a/tests/test_factory.py b/tests/test_factory.py
index bf3493ae5fa..ffb48965096 100644
--- a/tests/test_factory.py
+++ b/tests/test_factory.py
@@ -113,9 +113,7 @@ def test_create_poetry():
def test_create_poetry_with_packages_and_includes():
- poetry = Factory().create_poetry(
- fixtures_dir.parent / "masonry" / "builders" / "fixtures" / "with-include"
- )
+ poetry = Factory().create_poetry(fixtures_dir / "with-include")
package = poetry.package
diff --git a/tests/utils/test_env.py b/tests/utils/test_env.py
index e5926e68862..98d8e96700e 100644
--- a/tests/utils/test_env.py
+++ b/tests/utils/test_env.py
@@ -7,8 +7,8 @@
from clikit.io import NullIO
+from poetry.core.semver import Version
from poetry.factory import Factory
-from poetry.semver import Version
from poetry.utils._compat import WINDOWS
from poetry.utils._compat import Path
from poetry.utils.env import EnvCommandError
diff --git a/tests/utils/test_extras.py b/tests/utils/test_extras.py
index 83a184d97ae..424ccc5ee9e 100644
--- a/tests/utils/test_extras.py
+++ b/tests/utils/test_extras.py
@@ -1,6 +1,6 @@
import pytest
-from poetry.packages import Package
+from poetry.core.packages import Package
from poetry.utils.extras import get_extra_package_names
diff --git a/tests/vcs/__init__.py b/tests/vcs/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/vcs/test_git.py b/tests/vcs/test_git.py
deleted file mode 100644
index 062272151fb..00000000000
--- a/tests/vcs/test_git.py
+++ /dev/null
@@ -1,261 +0,0 @@
-import pytest
-
-from poetry.vcs.git import Git
-from poetry.vcs.git import GitUrl
-from poetry.vcs.git import ParsedUrl
-
-
-@pytest.mark.parametrize(
- "url, normalized",
- [
- (
- "git+ssh://user@hostname:project.git#commit",
- GitUrl("user@hostname:project.git", "commit"),
- ),
- (
- "git+http://user@hostname/project/blah.git@commit",
- GitUrl("http://user@hostname/project/blah.git", "commit"),
- ),
- (
- "git+https://user@hostname/project/blah.git",
- GitUrl("https://user@hostname/project/blah.git", None),
- ),
- (
- "git+https://user@hostname/project~_-.foo/blah~_-.bar.git",
- GitUrl("https://user@hostname/project~_-.foo/blah~_-.bar.git", None),
- ),
- (
- "git+https://user@hostname:project/blah.git",
- GitUrl("https://user@hostname/project/blah.git", None),
- ),
- (
- "git+ssh://git@github.com:sdispater/poetry.git#v1.0.27",
- GitUrl("git@github.com:sdispater/poetry.git", "v1.0.27"),
- ),
- (
- "git+ssh://git@github.com:/sdispater/poetry.git",
- GitUrl("git@github.com:/sdispater/poetry.git", None),
- ),
- ("git+ssh://git@github.com:org/repo", GitUrl("git@github.com:org/repo", None),),
- (
- "git+ssh://git@github.com/org/repo",
- GitUrl("ssh://git@github.com/org/repo", None),
- ),
- ("git+ssh://foo:22/some/path", GitUrl("ssh://foo:22/some/path", None)),
- ("git@github.com:org/repo", GitUrl("git@github.com:org/repo", None)),
- (
- "git+https://github.com/sdispater/pendulum",
- GitUrl("https://github.com/sdispater/pendulum", None),
- ),
- (
- "git+https://github.com/sdispater/pendulum#7a018f2d075b03a73409e8356f9b29c9ad4ea2c5",
- GitUrl(
- "https://github.com/sdispater/pendulum",
- "7a018f2d075b03a73409e8356f9b29c9ad4ea2c5",
- ),
- ),
- (
- "git+ssh://git@git.example.com:b/b.git#v1.0.0",
- GitUrl("git@git.example.com:b/b.git", "v1.0.0"),
- ),
- (
- "git+ssh://git@github.com:sdispater/pendulum.git#foo/bar",
- GitUrl("git@github.com:sdispater/pendulum.git", "foo/bar"),
- ),
- ("git+file:///foo/bar.git", GitUrl("file:///foo/bar.git", None)),
- (
- "git+file://C:\\Users\\hello\\testing.git#zkat/windows-files",
- GitUrl("file://C:\\Users\\hello\\testing.git", "zkat/windows-files"),
- ),
- (
- "git+https://git.example.com/sdispater/project/my_repo.git",
- GitUrl("https://git.example.com/sdispater/project/my_repo.git", None),
- ),
- (
- "git+ssh://git@git.example.com:sdispater/project/my_repo.git",
- GitUrl("git@git.example.com:sdispater/project/my_repo.git", None),
- ),
- ],
-)
-def test_normalize_url(url, normalized):
- assert normalized == Git.normalize_url(url)
-
-
-@pytest.mark.parametrize(
- "url, parsed",
- [
- (
- "git+ssh://user@hostname:project.git#commit",
- ParsedUrl(
- "ssh", "hostname", ":project.git", "user", None, "project", "commit"
- ),
- ),
- (
- "git+http://user@hostname/project/blah.git@commit",
- ParsedUrl(
- "http", "hostname", "/project/blah.git", "user", None, "blah", "commit"
- ),
- ),
- (
- "git+https://user@hostname/project/blah.git",
- ParsedUrl(
- "https", "hostname", "/project/blah.git", "user", None, "blah", None
- ),
- ),
- (
- "git+https://user@hostname/project~_-.foo/blah~_-.bar.git",
- ParsedUrl(
- "https",
- "hostname",
- "/project~_-.foo/blah~_-.bar.git",
- "user",
- None,
- "blah~_-.bar",
- None,
- ),
- ),
- (
- "git+https://user@hostname:project/blah.git",
- ParsedUrl(
- "https", "hostname", ":project/blah.git", "user", None, "blah", None
- ),
- ),
- (
- "git+ssh://git@github.com:sdispater/poetry.git#v1.0.27",
- ParsedUrl(
- "ssh",
- "github.com",
- ":sdispater/poetry.git",
- "git",
- None,
- "poetry",
- "v1.0.27",
- ),
- ),
- (
- "git+ssh://git@github.com:/sdispater/poetry.git",
- ParsedUrl(
- "ssh",
- "github.com",
- ":/sdispater/poetry.git",
- "git",
- None,
- "poetry",
- None,
- ),
- ),
- (
- "git+ssh://git@github.com:org/repo",
- ParsedUrl("ssh", "github.com", ":org/repo", "git", None, "repo", None),
- ),
- (
- "git+ssh://git@github.com/org/repo",
- ParsedUrl("ssh", "github.com", "/org/repo", "git", None, "repo", None),
- ),
- (
- "git+ssh://foo:22/some/path",
- ParsedUrl("ssh", "foo", "/some/path", None, "22", "path", None),
- ),
- (
- "git@github.com:org/repo",
- ParsedUrl(None, "github.com", ":org/repo", "git", None, "repo", None),
- ),
- (
- "git+https://github.com/sdispater/pendulum",
- ParsedUrl(
- "https",
- "github.com",
- "/sdispater/pendulum",
- None,
- None,
- "pendulum",
- None,
- ),
- ),
- (
- "git+https://github.com/sdispater/pendulum#7a018f2d075b03a73409e8356f9b29c9ad4ea2c5",
- ParsedUrl(
- "https",
- "github.com",
- "/sdispater/pendulum",
- None,
- None,
- "pendulum",
- "7a018f2d075b03a73409e8356f9b29c9ad4ea2c5",
- ),
- ),
- (
- "git+ssh://git@git.example.com:b/b.git#v1.0.0",
- ParsedUrl("ssh", "git.example.com", ":b/b.git", "git", None, "b", "v1.0.0"),
- ),
- (
- "git+ssh://git@github.com:sdispater/pendulum.git#foo/bar",
- ParsedUrl(
- "ssh",
- "github.com",
- ":sdispater/pendulum.git",
- "git",
- None,
- "pendulum",
- "foo/bar",
- ),
- ),
- (
- "git+file:///foo/bar.git",
- ParsedUrl("file", None, "/foo/bar.git", None, None, "bar", None),
- ),
- (
- "git+file://C:\\Users\\hello\\testing.git#zkat/windows-files",
- ParsedUrl(
- "file",
- "C",
- ":\\Users\\hello\\testing.git",
- None,
- None,
- "testing",
- "zkat/windows-files",
- ),
- ),
- (
- "git+https://git.example.com/sdispater/project/my_repo.git",
- ParsedUrl(
- "https",
- "git.example.com",
- "/sdispater/project/my_repo.git",
- None,
- None,
- "my_repo",
- None,
- ),
- ),
- (
- "git+ssh://git@git.example.com:sdispater/project/my_repo.git",
- ParsedUrl(
- "ssh",
- "git.example.com",
- ":sdispater/project/my_repo.git",
- "git",
- None,
- "my_repo",
- None,
- ),
- ),
- ],
-)
-def test_parse_url(url, parsed):
- result = ParsedUrl.parse(url)
- assert parsed.name == result.name
- assert parsed.pathname == result.pathname
- assert parsed.port == result.port
- assert parsed.protocol == result.protocol
- assert parsed.resource == result.resource
- assert parsed.rev == result.rev
- assert parsed.url == result.url
- assert parsed.user == result.user
-
-
-def test_parse_url_should_fail():
- url = "https://" + "@" * 64 + "!"
-
- with pytest.raises(ValueError):
- ParsedUrl.parse(url)
diff --git a/tests/version/__init__.py b/tests/version/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/tests/version/test_helpers.py b/tests/version/test_helpers.py
deleted file mode 100644
index e57de62abc5..00000000000
--- a/tests/version/test_helpers.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from poetry.semver import parse_constraint
-from poetry.version.helpers import format_python_constraint
-
-
-def test_format_python_constraint():
- constraint = parse_constraint("~2.7 || ^3.6")
-
- result = format_python_constraint(constraint)
-
- assert result == ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
-
-
-def test_format_python_constraint_single_version():
- constraint = parse_constraint("3.6")
-
- result = format_python_constraint(constraint)
-
- assert result == ">=3.6,<3.7"
-
- constraint = parse_constraint("3")
-
- result = format_python_constraint(constraint)
-
- assert result == ">=3.0,<4.0"
diff --git a/tests/version/test_markers.py b/tests/version/test_markers.py
deleted file mode 100644
index 2ef15c6ea27..00000000000
--- a/tests/version/test_markers.py
+++ /dev/null
@@ -1,606 +0,0 @@
-import os
-
-import pytest
-
-from poetry.version.markers import MarkerUnion
-from poetry.version.markers import MultiMarker
-from poetry.version.markers import SingleMarker
-from poetry.version.markers import parse_marker
-
-
-def test_single_marker():
- m = parse_marker('sys_platform == "darwin"')
-
- assert isinstance(m, SingleMarker)
- assert m.name == "sys_platform"
- assert m.constraint_string == "==darwin"
-
- m = parse_marker('python_version in "2.7, 3.0, 3.1"')
-
- assert isinstance(m, SingleMarker)
- assert m.name == "python_version"
- assert m.constraint_string == "in 2.7, 3.0, 3.1"
- assert str(m.constraint) == ">=2.7.0,<2.8.0 || >=3.0.0,<3.2.0"
-
- m = parse_marker('"2.7" in python_version')
-
- assert isinstance(m, SingleMarker)
- assert m.name == "python_version"
- assert m.constraint_string == "in 2.7"
- assert str(m.constraint) == ">=2.7.0,<2.8.0"
-
- m = parse_marker('python_version not in "2.7, 3.0, 3.1"')
-
- assert isinstance(m, SingleMarker)
- assert m.name == "python_version"
- assert m.constraint_string == "not in 2.7, 3.0, 3.1"
- assert str(m.constraint) == "<2.7.0 || >=2.8.0,<3.0.0 || >=3.2.0"
-
-
-def test_single_marker_intersect():
- m = parse_marker('sys_platform == "darwin"')
-
- intersection = m.intersect(parse_marker('implementation_name == "cpython"'))
- assert (
- str(intersection)
- == 'sys_platform == "darwin" and implementation_name == "cpython"'
- )
-
- m = parse_marker('python_version >= "3.4"')
-
- intersection = m.intersect(parse_marker('python_version < "3.6"'))
- assert str(intersection) == 'python_version >= "3.4" and python_version < "3.6"'
-
-
-def test_single_marker_intersect_compacts_constraints():
- m = parse_marker('python_version < "3.6"')
-
- intersection = m.intersect(parse_marker('python_version < "3.4"'))
- assert str(intersection) == 'python_version < "3.4"'
-
-
-def test_single_marker_intersect_with_multi():
- m = parse_marker('sys_platform == "darwin"')
-
- intersection = m.intersect(
- parse_marker('implementation_name == "cpython" and python_version >= "3.6"')
- )
- assert (
- str(intersection)
- == 'implementation_name == "cpython" and python_version >= "3.6" and sys_platform == "darwin"'
- )
-
-
-def test_single_marker_intersect_with_multi_with_duplicate():
- m = parse_marker('python_version < "4.0"')
-
- intersection = m.intersect(
- parse_marker('sys_platform == "darwin" and python_version < "4.0"')
- )
- assert str(intersection) == 'sys_platform == "darwin" and python_version < "4.0"'
-
-
-def test_single_marker_intersect_with_multi_compacts_constraint():
- m = parse_marker('python_version < "3.6"')
-
- intersection = m.intersect(
- parse_marker('implementation_name == "cpython" and python_version < "3.4"')
- )
- assert (
- str(intersection)
- == 'implementation_name == "cpython" and python_version < "3.4"'
- )
-
-
-def test_single_marker_not_in_python_intersection():
- m = parse_marker('python_version not in "2.7, 3.0, 3.1"')
-
- intersection = m.intersect(
- parse_marker('python_version not in "2.7, 3.0, 3.1, 3.2"')
- )
- assert str(intersection) == 'python_version not in "2.7, 3.0, 3.1, 3.2"'
-
-
-def test_single_marker_union():
- m = parse_marker('sys_platform == "darwin"')
-
- intersection = m.union(parse_marker('implementation_name == "cpython"'))
- assert (
- str(intersection)
- == 'sys_platform == "darwin" or implementation_name == "cpython"'
- )
-
- m = parse_marker('python_version >= "3.4"')
-
- intersection = m.union(parse_marker('python_version < "3.6"'))
- assert str(intersection) == 'python_version >= "3.4" or python_version < "3.6"'
-
-
-def test_single_marker_union_compacts_constraints():
- m = parse_marker('python_version < "3.6"')
-
- union = m.union(parse_marker('python_version < "3.4"'))
- assert str(union) == 'python_version < "3.6"'
-
-
-def test_single_marker_union_with_multi():
- m = parse_marker('sys_platform == "darwin"')
-
- union = m.union(
- parse_marker('implementation_name == "cpython" and python_version >= "3.6"')
- )
- assert (
- str(union)
- == 'implementation_name == "cpython" and python_version >= "3.6" or sys_platform == "darwin"'
- )
-
-
-def test_single_marker_union_with_multi_duplicate():
- m = parse_marker('sys_platform == "darwin" and python_version >= "3.6"')
-
- union = m.union(
- parse_marker('sys_platform == "darwin" and python_version >= "3.6"')
- )
- assert str(union) == 'sys_platform == "darwin" and python_version >= "3.6"'
-
-
-def test_single_marker_union_with_union():
- m = parse_marker('sys_platform == "darwin"')
-
- union = m.union(
- parse_marker('implementation_name == "cpython" or python_version >= "3.6"')
- )
- assert (
- str(union)
- == 'implementation_name == "cpython" or python_version >= "3.6" or sys_platform == "darwin"'
- )
-
-
-def test_single_marker_not_in_python_union():
- m = parse_marker('python_version not in "2.7, 3.0, 3.1"')
-
- union = m.union(parse_marker('python_version not in "2.7, 3.0, 3.1, 3.2"'))
- assert str(union) == 'python_version not in "2.7, 3.0, 3.1"'
-
-
-def test_single_marker_union_with_union_duplicate():
- m = parse_marker('sys_platform == "darwin"')
-
- union = m.union(parse_marker('sys_platform == "darwin" or python_version >= "3.6"'))
- assert str(union) == 'sys_platform == "darwin" or python_version >= "3.6"'
-
- m = parse_marker('python_version >= "3.7"')
-
- union = m.union(parse_marker('sys_platform == "darwin" or python_version >= "3.6"'))
- assert str(union) == 'sys_platform == "darwin" or python_version >= "3.6"'
-
- m = parse_marker('python_version <= "3.6"')
-
- union = m.union(parse_marker('sys_platform == "darwin" or python_version < "3.4"'))
- assert str(union) == 'sys_platform == "darwin" or python_version <= "3.6"'
-
-
-def test_multi_marker():
- m = parse_marker('sys_platform == "darwin" and implementation_name == "cpython"')
-
- assert isinstance(m, MultiMarker)
- assert m.markers == [
- parse_marker('sys_platform == "darwin"'),
- parse_marker('implementation_name == "cpython"'),
- ]
-
-
-def test_multi_marker_is_empty_is_contradictory():
- m = parse_marker(
- 'sys_platform == "linux" and python_version >= "3.5" and python_version < "2.8"'
- )
-
- assert m.is_empty()
-
- m = parse_marker('sys_platform == "linux" and sys_platform == "win32"')
-
- assert m.is_empty()
-
-
-def test_multi_marker_intersect_multi():
- m = parse_marker('sys_platform == "darwin" and implementation_name == "cpython"')
-
- intersection = m.intersect(
- parse_marker('python_version >= "3.6" and os_name == "Windows"')
- )
- assert str(intersection) == (
- 'sys_platform == "darwin" and implementation_name == "cpython" '
- 'and python_version >= "3.6" and os_name == "Windows"'
- )
-
-
-def test_multi_marker_intersect_multi_with_overlapping_constraints():
- m = parse_marker('sys_platform == "darwin" and python_version < "3.6"')
-
- intersection = m.intersect(
- parse_marker(
- 'python_version <= "3.4" and os_name == "Windows" and sys_platform == "darwin"'
- )
- )
- assert str(intersection) == (
- 'sys_platform == "darwin" and python_version <= "3.4" and os_name == "Windows"'
- )
-
-
-def test_multi_marker_union_multi():
- m = parse_marker('sys_platform == "darwin" and implementation_name == "cpython"')
-
- intersection = m.union(
- parse_marker('python_version >= "3.6" and os_name == "Windows"')
- )
- assert str(intersection) == (
- 'sys_platform == "darwin" and implementation_name == "cpython" '
- 'or python_version >= "3.6" and os_name == "Windows"'
- )
-
-
-def test_multi_marker_union_with_union():
- m = parse_marker('sys_platform == "darwin" and implementation_name == "cpython"')
-
- intersection = m.union(
- parse_marker('python_version >= "3.6" or os_name == "Windows"')
- )
- assert str(intersection) == (
- 'python_version >= "3.6" or os_name == "Windows"'
- ' or sys_platform == "darwin" and implementation_name == "cpython"'
- )
-
-
-def test_marker_union():
- m = parse_marker('sys_platform == "darwin" or implementation_name == "cpython"')
-
- assert isinstance(m, MarkerUnion)
- assert m.markers == [
- parse_marker('sys_platform == "darwin"'),
- parse_marker('implementation_name == "cpython"'),
- ]
-
-
-def test_marker_union_deduplicate():
- m = parse_marker(
- 'sys_platform == "darwin" or implementation_name == "cpython" or sys_platform == "darwin"'
- )
-
- assert str(m) == 'sys_platform == "darwin" or implementation_name == "cpython"'
-
-
-def test_marker_union_intersect_single_marker():
- m = parse_marker('sys_platform == "darwin" or python_version < "3.4"')
-
- intersection = m.intersect(parse_marker('implementation_name == "cpython"'))
- assert str(intersection) == (
- 'sys_platform == "darwin" and implementation_name == "cpython" '
- 'or python_version < "3.4" and implementation_name == "cpython"'
- )
-
-
-def test_marker_union_intersect_single_with_overlapping_constraints():
- m = parse_marker('sys_platform == "darwin" or python_version < "3.4"')
-
- intersection = m.intersect(parse_marker('python_version <= "3.6"'))
- assert (
- str(intersection)
- == 'sys_platform == "darwin" and python_version <= "3.6" or python_version < "3.4"'
- )
-
- m = parse_marker('sys_platform == "darwin" or python_version < "3.4"')
- intersection = m.intersect(parse_marker('sys_platform == "darwin"'))
- assert (
- str(intersection)
- == 'sys_platform == "darwin" or python_version < "3.4" and sys_platform == "darwin"'
- )
-
-
-def test_marker_union_intersect_marker_union():
- m = parse_marker('sys_platform == "darwin" or python_version < "3.4"')
-
- intersection = m.intersect(
- parse_marker('implementation_name == "cpython" or os_name == "Windows"')
- )
- assert str(intersection) == (
- 'sys_platform == "darwin" and implementation_name == "cpython" '
- 'or sys_platform == "darwin" and os_name == "Windows" or '
- 'python_version < "3.4" and implementation_name == "cpython" or '
- 'python_version < "3.4" and os_name == "Windows"'
- )
-
-
-def test_marker_union_intersect_marker_union_drops_unnecessary_markers():
- m = parse_marker(
- 'python_version >= "2.7" and python_version < "2.8" '
- 'or python_version >= "3.4" and python_version < "4.0"'
- )
- m2 = parse_marker(
- 'python_version >= "2.7" and python_version < "2.8" '
- 'or python_version >= "3.4" and python_version < "4.0"'
- )
-
- intersection = m.intersect(m2)
- expected = (
- 'python_version >= "2.7" and python_version < "2.8" '
- 'or python_version >= "3.4" and python_version < "4.0"'
- )
- assert expected == str(intersection)
-
-
-def test_marker_union_intersect_multi_marker():
- m = parse_marker('sys_platform == "darwin" or python_version < "3.4"')
-
- intersection = m.intersect(
- parse_marker('implementation_name == "cpython" and os_name == "Windows"')
- )
- assert str(intersection) == (
- 'implementation_name == "cpython" and os_name == "Windows" and sys_platform == "darwin" '
- 'or implementation_name == "cpython" and os_name == "Windows" and python_version < "3.4"'
- )
-
-
-def test_marker_union_union_with_union():
- m = parse_marker('sys_platform == "darwin" or python_version < "3.4"')
-
- union = m.union(
- parse_marker('implementation_name == "cpython" or os_name == "Windows"')
- )
- assert str(union) == (
- 'sys_platform == "darwin" or python_version < "3.4" '
- 'or implementation_name == "cpython" or os_name == "Windows"'
- )
-
-
-def test_marker_union_union_duplicates():
- m = parse_marker('sys_platform == "darwin" or python_version < "3.4"')
-
- union = m.union(parse_marker('sys_platform == "darwin" or os_name == "Windows"'))
- assert str(union) == (
- 'sys_platform == "darwin" or python_version < "3.4" or os_name == "Windows"'
- )
-
- m = parse_marker('sys_platform == "darwin" or python_version < "3.4"')
-
- union = m.union(
- parse_marker(
- 'sys_platform == "darwin" or os_name == "Windows" or python_version <= "3.6"'
- )
- )
- assert str(union) == (
- 'sys_platform == "darwin" or python_version <= "3.6" or os_name == "Windows"'
- )
-
-
-def test_marker_union_all_any():
- union = MarkerUnion(parse_marker(""), parse_marker(""))
-
- assert union.is_any()
-
-
-def test_marker_union_not_all_any():
- union = MarkerUnion(parse_marker(""), parse_marker(""), parse_marker(""))
-
- assert union.is_any()
-
-
-def test_marker_union_all_empty():
- union = MarkerUnion(parse_marker(""), parse_marker(""))
-
- assert union.is_empty()
-
-
-def test_marker_union_not_all_empty():
- union = MarkerUnion(
- parse_marker(""), parse_marker(""), parse_marker("")
- )
-
- assert not union.is_empty()
-
-
-def test_marker_str_conversion_skips_empty_and_any():
- union = MarkerUnion(
- parse_marker(""),
- parse_marker(
- 'sys_platform == "darwin" or python_version <= "3.6" or os_name == "Windows"'
- ),
- parse_marker(""),
- )
-
- assert str(union) == (
- 'sys_platform == "darwin" or python_version <= "3.6" or os_name == "Windows"'
- )
-
-
-def test_intersect_compacts_constraints():
- m = parse_marker('python_version < "4.0"')
-
- intersection = m.intersect(parse_marker('python_version < "5.0"'))
- assert str(intersection) == 'python_version < "4.0"'
-
-
-def test_multi_marker_removes_duplicates():
- m = parse_marker('sys_platform == "win32" and sys_platform == "win32"')
-
- assert 'sys_platform == "win32"' == str(m)
-
- m = parse_marker(
- 'sys_platform == "darwin" and implementation_name == "cpython" '
- 'and sys_platform == "darwin" and implementation_name == "cpython"'
- )
-
- assert 'sys_platform == "darwin" and implementation_name == "cpython"' == str(m)
-
-
-@pytest.mark.parametrize(
- ("marker_string", "environment", "expected"),
- [
- ("os_name == '{0}'".format(os.name), None, True),
- ("os_name == 'foo'", {"os_name": "foo"}, True),
- ("os_name == 'foo'", {"os_name": "bar"}, False),
- ("'2.7' in python_version", {"python_version": "2.7.5"}, True),
- ("'2.7' not in python_version", {"python_version": "2.7"}, False),
- (
- "os_name == 'foo' and python_version ~= '2.7.0'",
- {"os_name": "foo", "python_version": "2.7.6"},
- True,
- ),
- (
- "python_version ~= '2.7.0' and (os_name == 'foo' or " "os_name == 'bar')",
- {"os_name": "foo", "python_version": "2.7.4"},
- True,
- ),
- (
- "python_version ~= '2.7.0' and (os_name == 'foo' or " "os_name == 'bar')",
- {"os_name": "bar", "python_version": "2.7.4"},
- True,
- ),
- (
- "python_version ~= '2.7.0' and (os_name == 'foo' or " "os_name == 'bar')",
- {"os_name": "other", "python_version": "2.7.4"},
- False,
- ),
- ("extra == 'security'", {"extra": "quux"}, False),
- ("extra == 'security'", {"extra": "security"}, True),
- ("os.name == '{0}'".format(os.name), None, True),
- ("sys.platform == 'win32'", {"sys_platform": "linux2"}, False),
- ("platform.version in 'Ubuntu'", {"platform_version": "#39"}, False),
- ("platform.machine=='x86_64'", {"platform_machine": "x86_64"}, True),
- (
- "platform.python_implementation=='Jython'",
- {"platform_python_implementation": "CPython"},
- False,
- ),
- (
- "python_version == '2.5' and platform.python_implementation" "!= 'Jython'",
- {"python_version": "2.7"},
- False,
- ),
- ],
-)
-def test_validate(marker_string, environment, expected):
- m = parse_marker(marker_string)
-
- assert m.validate(environment) is expected
-
-
-@pytest.mark.parametrize(
- "marker, env",
- [
- (
- 'platform_release >= "9.0" and platform_release < "11.0"',
- {"platform_release": "10.0"},
- )
- ],
-)
-def test_parse_version_like_markers(marker, env):
- m = parse_marker(marker)
-
- assert m.validate(env)
-
-
-@pytest.mark.parametrize(
- "marker, expected",
- [
- ('python_version >= "3.6"', 'python_version >= "3.6"'),
- ('python_version >= "3.6" and extra == "foo"', 'python_version >= "3.6"'),
- (
- 'python_version >= "3.6" and (extra == "foo" or extra == "bar")',
- 'python_version >= "3.6"',
- ),
- (
- 'python_version >= "3.6" and (extra == "foo" or extra == "bar") or implementation_name == "pypy"',
- 'python_version >= "3.6" or implementation_name == "pypy"',
- ),
- (
- 'python_version >= "3.6" and extra == "foo" or implementation_name == "pypy" and extra == "bar"',
- 'python_version >= "3.6" or implementation_name == "pypy"',
- ),
- (
- 'python_version >= "3.6" or extra == "foo" and implementation_name == "pypy" or extra == "bar"',
- 'python_version >= "3.6" or implementation_name == "pypy"',
- ),
- ],
-)
-def test_without_extras(marker, expected):
- m = parse_marker(marker)
-
- assert expected == str(m.without_extras())
-
-
-@pytest.mark.parametrize(
- "marker, excluded, expected",
- [
- ('python_version >= "3.6"', "implementation_name", 'python_version >= "3.6"'),
- ('python_version >= "3.6"', "python_version", "*"),
- (
- 'python_version >= "3.6" and extra == "foo"',
- "extra",
- 'python_version >= "3.6"',
- ),
- (
- 'python_version >= "3.6" and (extra == "foo" or extra == "bar")',
- "python_version",
- '(extra == "foo" or extra == "bar")',
- ),
- (
- 'python_version >= "3.6" and (extra == "foo" or extra == "bar") or implementation_name == "pypy"',
- "python_version",
- '(extra == "foo" or extra == "bar") or implementation_name == "pypy"',
- ),
- (
- 'python_version >= "3.6" and extra == "foo" or implementation_name == "pypy" and extra == "bar"',
- "implementation_name",
- 'python_version >= "3.6" and extra == "foo" or extra == "bar"',
- ),
- (
- 'python_version >= "3.6" or extra == "foo" and implementation_name == "pypy" or extra == "bar"',
- "implementation_name",
- 'python_version >= "3.6" or extra == "foo" or extra == "bar"',
- ),
- ],
-)
-def test_exclude(marker, excluded, expected):
- m = parse_marker(marker)
-
- if expected == "*":
- assert m.exclude(excluded).is_any()
- else:
- assert expected == str(m.exclude(excluded))
-
-
-@pytest.mark.parametrize(
- "marker, only, expected",
- [
- ('python_version >= "3.6"', "python_version", 'python_version >= "3.6"'),
- (
- 'python_version >= "3.6" and extra == "foo"',
- "python_version",
- 'python_version >= "3.6"',
- ),
- (
- 'python_version >= "3.6" and (extra == "foo" or extra == "bar")',
- "extra",
- '(extra == "foo" or extra == "bar")',
- ),
- (
- 'python_version >= "3.6" and (extra == "foo" or extra == "bar") or implementation_name == "pypy"',
- "implementation_name",
- 'implementation_name == "pypy"',
- ),
- (
- 'python_version >= "3.6" and extra == "foo" or implementation_name == "pypy" and extra == "bar"',
- "implementation_name",
- 'implementation_name == "pypy"',
- ),
- (
- 'python_version >= "3.6" or extra == "foo" and implementation_name == "pypy" or extra == "bar"',
- "implementation_name",
- 'implementation_name == "pypy"',
- ),
- ],
-)
-def test_only(marker, only, expected):
- m = parse_marker(marker)
-
- assert expected == str(m.only(only))