From 5f62c016cc4df349a05ebc483df3edac1ecab78e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 10 Feb 2018 20:05:57 +0100 Subject: [PATCH] Fix test_standarddir.TestCreatingDir What we actually want to test here is that the given type directory is created and has the correct permission, we don't care much about the basedir itself. Also, the download dir is not created automatically. This test failed on Python 3.7 because intermediate directories now aren't created with the given mode anymore: https://bugs.python.org/issue19930 https://docs.python.org/3.7/whatsnew/3.7.html#changes-in-the-python-api --- tests/unit/utils/test_standarddir.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/unit/utils/test_standarddir.py b/tests/unit/utils/test_standarddir.py index c95e83c41..8d110f05b 100644 --- a/tests/unit/utils/test_standarddir.py +++ b/tests/unit/utils/test_standarddir.py @@ -301,6 +301,7 @@ class TestCreatingDir: """Test --basedir.""" basedir = tmpdir / 'basedir' assert not basedir.exists() + args = types.SimpleNamespace(basedir=str(basedir)) standarddir._init_dirs(args) @@ -309,8 +310,13 @@ class TestCreatingDir: assert basedir.exists() - if utils.is_posix: - assert basedir.stat().mode & 0o777 == 0o700 + if typ == 'download': + assert not (basedir / typ).exists() + else: + assert (basedir / typ).exists() + + if utils.is_posix: + assert (basedir / typ).stat().mode & 0o777 == 0o700 @pytest.mark.parametrize('typ', DIR_TYPES) def test_exists_race_condition(self, mocker, tmpdir, typ):