Remove outer class for temp_dir tests
@@ -9,11 +9,9 @@ from pip._internal.utils.misc import ensure_dir
from pip._internal.utils.temp_dir import AdjacentTempDirectory, TempDirectory
-class TestTempDirectory(object):
-
# No need to test symlinked directories on Windows
@pytest.mark.skipif("sys.platform == 'win32'")
- def test_symlinked_path(self):
+def test_symlinked_path():
with TempDirectory() as tmp_dir:
assert os.path.exists(tmp_dir.path)
@@ -36,7 +34,8 @@ class TestTempDirectory(object):
os.rmdir(tmp_dir.path)
assert not os.path.exists(tmp_dir.path)
- def test_deletes_readonly_files(self):
+
+def test_deletes_readonly_files():
def create_file(*args):
fpath = os.path.join(*args)
ensure_dir(os.path.dirname(fpath))
@@ -58,7 +57,8 @@ class TestTempDirectory(object):
assert not os.path.exists(tmp_dir.path)
- def test_create_and_cleanup_work(self):
+
+def test_create_and_cleanup_work():
tmp_dir = TempDirectory()
created_path = tmp_dir.path
@@ -69,6 +69,7 @@ class TestTempDirectory(object):
assert tmp_dir.path is not None
assert not os.path.exists(created_path)
+
@pytest.mark.parametrize("name", [
"ABC",
"ABC.dist-info",
@@ -79,7 +80,7 @@ class TestTempDirectory(object):
"A",
"2",
])
- def test_adjacent_directory_names(self, name):
+def test_adjacent_directory_names(name):
def names():
return AdjacentTempDirectory._generate_names(name)
@@ -132,6 +133,7 @@ class TestTempDirectory(object):
# All names are going to end with our original
assert all(x.endswith(name) for x in some_names)
+
@pytest.mark.parametrize("name", [
"A",
"ABC",
@@ -139,7 +141,7 @@ class TestTempDirectory(object):
"_+-",
"_package",
])
- def test_adjacent_directory_exists(self, name, tmpdir):
+def test_adjacent_directory_exists(name, tmpdir):
block_name, expect_name = itertools.islice(
AdjacentTempDirectory._generate_names(name), 2)
@@ -152,7 +154,8 @@ class TestTempDirectory(object):
with AdjacentTempDirectory(original) as atmp_dir:
assert expect_name == os.path.split(atmp_dir.path)[1]
- def test_adjacent_directory_permission_error(self, monkeypatch):
+
+def test_adjacent_directory_permission_error(monkeypatch):
name = "ABC"
def raising_mkdir(*args, **kwargs):
