diff --git a/beets/ui/commands.py b/beets/ui/commands.py index da78d682a..394a2831a 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1404,7 +1404,7 @@ default_commands.append(version_cmd) def database_dir_creation(path): # Ask the user for a choice. - return ui.input_yn("{} does not exist, create it (Y/n)?" + return ui.input_yn("The database directory {} does not exists, create it (Y/n)?" .format(displayable_path(path))) diff --git a/test/test_dbcore.py b/test/test_dbcore.py index 5dbff5223..c92f31c1f 100644 --- a/test/test_dbcore.py +++ b/test/test_dbcore.py @@ -762,25 +762,22 @@ class ResultsIteratorTest(unittest.TestCase): ModelFixture1, dbcore.query.FalseQuery()).get()) -class ParentalDirCreation(unittest.TestCase): +class ParentalDirCreation(_common.TestCase): @mock.patch('builtins.input', side_effect=['y', ]) def test_create_yes(self, _): - non_exist_path = "ParentalDirCreationTest/nonexist/" + str(random()) - try: - dbcore.Database(non_exist_path) - except OSError as e: - raise e - shutil.rmtree("ParentalDirCreationTest") + non_exist_path = _common.util.py3_path(os.path.join( + self.temp_dir, b'nonexist', str(random()).encode())) + dbcore.Database(non_exist_path) @mock.patch('builtins.input', side_effect=['n', ]) def test_create_no(self, _): - non_exist_path = "ParentalDirCreationTest/nonexist/" + str(random()) - try: - dbcore.Database(non_exist_path) - except OSError as e: - raise e - if os.path.exists("ParentalDirCreationTest/nonexist/"): - shutil.rmtree("ParentalDirCreationTest") + non_exist_path_parent = _common.util.py3_path( + os.path.join(self.temp_dir, b'nonexist')) + non_exist_path = _common.util.py3_path(os.path.join( + non_exist_path_parent.encode(), str(random()).encode())) + dbcore.Database(non_exist_path) + if os.path.exists(non_exist_path_parent): + shutil.rmtree(non_exist_path_parent) raise OSError("Should not create dir")