forked from LBRYCommunity/lbry-sdk
removed redundant tests
renamed a test to be more specific about the kind of the precondition
This commit is contained in:
parent
6b8d4a444b
commit
9c5f5aefb0
1 changed files with 1 additions and 12 deletions
|
@ -211,22 +211,11 @@ class DirectoryTests(FakeFSTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.setUpPyfakefs()
|
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):
|
def test_when_parent_dir_does_not_exist_then_dir_is_created_with_parent(self):
|
||||||
dir_path = os.path.join("parent_dir", "dir")
|
dir_path = os.path.join("parent_dir", "dir")
|
||||||
ensure_directory_exists(dir_path)
|
ensure_directory_exists(dir_path)
|
||||||
self.assertTrue(os.path.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):
|
def test_when_non_writable_dir_exists_then_raise(self):
|
||||||
dir_path = "dir"
|
dir_path = "dir"
|
||||||
pathlib.Path(dir_path).mkdir(mode=0o555) # creates a non-writable, readable and executable 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:
|
except (FileExistsError, PermissionError) as err:
|
||||||
self.fail(f"{type(err).__name__} was raised")
|
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"
|
file_path = "file.extension"
|
||||||
self.fs.create_file(file_path)
|
self.fs.create_file(file_path)
|
||||||
with self.assertRaises(FileExistsError):
|
with self.assertRaises(FileExistsError):
|
||||||
|
|
Loading…
Reference in a new issue