Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Tso committed Oct 15, 2020
1 parent e5335b1 commit ad97419
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
4 changes: 3 additions & 1 deletion poetry/core/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class Factory(object):
Factory class to create various elements needed by Poetry.
"""

def create_poetry(self, cwd=None, with_dev=True): # type: (Optional[Path]. bool) -> Poetry
def create_poetry(
self, cwd=None, with_dev=True
): # type: (Optional[Path]. bool) -> Poetry
poetry_file = self.locate(cwd)
local_config = PyProjectTOML(path=poetry_file).poetry_config

Expand Down
30 changes: 18 additions & 12 deletions tests/masonry/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ def test_build_wheel_with_include():


def test_build_wheel_with_bad_path_dev_dep_succeeds():
with temporary_directory() as tmp_dir, cwd(os.path.join(fixtures, "with_bad_path_dev_dep")):
with temporary_directory() as tmp_dir, cwd(
os.path.join(fixtures, "with_bad_path_dev_dep")
):
api.build_wheel(tmp_dir)


def test_build_wheel_with_bad_path_dep_fails():
with pytest.raises(ValueError) as err,\
temporary_directory() as tmp_dir, \
cwd(os.path.join(fixtures, "with_bad_path_dep")):
with pytest.raises(ValueError) as err,temporary_directory() as tmp_dir, cwd(
os.path.join(fixtures, "with_bad_path_dep")
):
api.build_wheel(tmp_dir)
assert "../only/in/dev" in str(err.value)

Expand Down Expand Up @@ -115,14 +117,16 @@ def test_build_sdist_with_include():


def test_build_sdist_with_bad_path_dev_dep_succeeds():
with temporary_directory() as tmp_dir, cwd(os.path.join(fixtures, "with_bad_path_dev_dep")):
with temporary_directory() as tmp_dir, cwd(
os.path.join(fixtures, "with_bad_path_dev_dep")
):
api.build_sdist(tmp_dir)


def test_build_sdist_with_bad_path_dep_fails():
with pytest.raises(ValueError) as err, \
temporary_directory() as tmp_dir, \
cwd(os.path.join(fixtures, "with_bad_path_dep")):
with pytest.raises(ValueError) as err, temporary_directory() as tmp_dir, cwd(
os.path.join(fixtures, "with_bad_path_dep")
):
api.build_sdist(tmp_dir)
assert "../only/in/dev" in str(err.value)

Expand Down Expand Up @@ -199,13 +203,15 @@ def test_prepare_metadata_for_build_wheel():


def test_prepare_metadata_for_build_wheel_with_bad_path_dev_dep_succeeds():
with temporary_directory() as tmp_dir, cwd(os.path.join(fixtures, "with_bad_path_dev_dep")):
with temporary_directory() as tmp_dir, cwd(
os.path.join(fixtures, "with_bad_path_dev_dep")
):
api.prepare_metadata_for_build_wheel(tmp_dir)


def test_prepare_metadata_for_build_wheel_with_bad_path_dep_succeeds():
with pytest.raises(ValueError) as err, \
temporary_directory() as tmp_dir, \
cwd(os.path.join(fixtures, "with_bad_path_dep")):
with pytest.raises(ValueError) as err, temporary_directory() as tmp_dir, cwd(
os.path.join(fixtures, "with_bad_path_dep")
):
api.prepare_metadata_for_build_wheel(tmp_dir)
assert "../only/in/dev" in str(err.value)
8 changes: 4 additions & 4 deletions tests/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def test_create_poetry():
assert package.authors == ["Sébastien Eustace <sebastien@eustace.io>"]
assert package.license.id == "MIT"
assert (
package.readme.relative_to(fixtures_dir).as_posix()
== "sample_project/README.rst"
package.readme.relative_to(fixtures_dir).as_posix()
== "sample_project/README.rst"
)
assert package.homepage == "https://python-poetry.org"
assert package.repository_url == "https://github.com/python-poetry/poetry"
Expand Down Expand Up @@ -95,8 +95,8 @@ def test_create_poetry():
assert functools32.name == "functools32"
assert functools32.pretty_constraint == "^3.2.3"
assert (
str(functools32.marker)
== 'python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5"'
str(functools32.marker)
== 'python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5"'
)

assert "db" in package.extras
Expand Down

0 comments on commit ad97419

Please sign in to comment.