removed redundant tests

renamed a test to be more specific about the kind of the precondition
This commit is contained in:
FemtosecondLaser 2021-10-21 00:27:31 +01:00 committed by Victor Shyba
parent bed2e253b2
commit 6c10509705

View file

@ -211,22 +211,11 @@ class DirectoryTests(FakeFSTestCase):
def setUp(self):
self.setUpPyfakefs()
def test_when_dir_does_not_exist_then_it_is_created(self):
dir_path = "dir"
ensure_directory_exists(dir_path)
self.assertTrue(os.path.exists(dir_path))
def test_when_parent_dir_does_not_exist_then_dir_is_created_with_parent(self):
dir_path = os.path.join("parent_dir", "dir")
ensure_directory_exists(dir_path)
self.assertTrue(os.path.exists(dir_path))
def test_when_dir_exists_then_it_still_exists(self):
dir_path = "dir"
pathlib.Path(dir_path).mkdir()
ensure_directory_exists(dir_path)
self.assertTrue(os.path.exists(dir_path))
def test_when_non_writable_dir_exists_then_raise(self):
dir_path = "dir"
pathlib.Path(dir_path).mkdir(mode=0o555) # creates a non-writable, readable and executable dir
@ -241,7 +230,7 @@ class DirectoryTests(FakeFSTestCase):
except (FileExistsError, PermissionError) as err:
self.fail(f"{type(err).__name__} was raised")
def test_when_file_exists_at_path_then_raise(self):
def test_when_non_dir_file_exists_at_path_then_raise(self):
file_path = "file.extension"
self.fs.create_file(file_path)
with self.assertRaises(FileExistsError):