Skip to content

Commit

Permalink
tests: remove unused imports and mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
layday committed Nov 8, 2020
1 parent 09bc177 commit 06a282e
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions tests/test_projectbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@
import build

if sys.version_info >= (3, 8): # pragma: no cover
import email
from importlib import metadata as importlib_metadata

email_message_from_string = email.message_from_string
else: # pragma: no cover
import importlib_metadata

email_message_from_string = importlib_metadata._compat.email_message_from_string

if sys.version_info >= (3,): # pragma: no cover
build_open_owner = 'builtins'
else: # pragma: no cover
Expand Down Expand Up @@ -93,11 +88,6 @@ def test_check_dependency(requirement_string, expected):


def test_init(mocker, test_flit_path, legacy_path, test_no_permission, test_bad_syntax_path):
modules = {
'flit_core.buildapi': None,
'setuptools.build_meta:__legacy__': None,
}
mocker.patch('importlib.import_module', modules.get)
mocker.patch('pep517.wrappers.Pep517HookCaller')

# correct flit pyproject.toml
Expand Down Expand Up @@ -174,7 +164,6 @@ def test_build_missing_backend(packages_path, distribution, tmpdir):


def test_check_dependencies(mocker, test_flit_path):
mocker.patch('importlib.import_module', autospec=True)
mocker.patch('pep517.wrappers.Pep517HookCaller.get_requires_for_build_sdist')
mocker.patch('pep517.wrappers.Pep517HookCaller.get_requires_for_build_wheel')

Expand Down Expand Up @@ -211,7 +200,6 @@ def test_working_directory(tmp_dir):


def test_build(mocker, test_flit_path, tmp_dir):
mocker.patch('importlib.import_module', autospec=True)
mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True)
mocker.patch('build._working_directory', autospec=True)

Expand All @@ -238,7 +226,6 @@ def test_build(mocker, test_flit_path, tmp_dir):


def test_default_backend(mocker, legacy_path):
mocker.patch('importlib.import_module', autospec=True)
mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True)

builder = build.ProjectBuilder(legacy_path)
Expand All @@ -247,7 +234,6 @@ def test_default_backend(mocker, legacy_path):


def test_missing_backend(mocker, test_no_backend_path):
mocker.patch('importlib.import_module', autospec=True)
mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True)

builder = build.ProjectBuilder(test_no_backend_path)
Expand All @@ -256,23 +242,20 @@ def test_missing_backend(mocker, test_no_backend_path):


def test_missing_requires(mocker, test_no_requires_path):
mocker.patch('importlib.import_module', autospec=True)
mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True)

with pytest.raises(build.BuildException):
build.ProjectBuilder(test_no_requires_path)


def test_build_system_typo(mocker, test_typo):
mocker.patch('importlib.import_module', autospec=True)
mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True)

with pytest.warns(build.TypoWarning):
build.ProjectBuilder(test_typo)


def test_missing_outdir(mocker, tmp_dir, test_flit_path):
mocker.patch('importlib.import_module', autospec=True)
mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True)

builder = build.ProjectBuilder(test_flit_path)
Expand All @@ -284,7 +267,6 @@ def test_missing_outdir(mocker, tmp_dir, test_flit_path):


def test_relative_outdir(mocker, tmp_dir, test_flit_path):
mocker.patch('importlib.import_module', autospec=True)
mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True)

builder = build.ProjectBuilder(test_flit_path)
Expand All @@ -295,7 +277,6 @@ def test_relative_outdir(mocker, tmp_dir, test_flit_path):


def test_not_dir_outdir(mocker, tmp_dir, test_flit_path):
mocker.patch('importlib.import_module', autospec=True)
mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True)

builder = build.ProjectBuilder(test_flit_path)
Expand Down

0 comments on commit 06a282e

Please sign in to comment.