Просмотр исходного кода

fix flake8 warnings in my recent PRs

Antoine Beaupré 9 лет назад
Родитель
Сommit
8651f87fa1
2 измененных файлов с 7 добавлено и 5 удалено
  1. 0 1
      borg/testsuite/logger.py
  2. 7 4
      borg/testsuite/upgrader.py

+ 0 - 1
borg/testsuite/logger.py

@@ -1,6 +1,5 @@
 import logging
 import logging
 from io import StringIO
 from io import StringIO
-import sys
 
 
 from mock import Mock
 from mock import Mock
 import pytest
 import pytest

+ 7 - 4
borg/testsuite/upgrader.py

@@ -1,6 +1,4 @@
 import os
 import os
-import shutil
-import tempfile
 
 
 import pytest
 import pytest
 
 
@@ -15,7 +13,6 @@ from ..upgrader import AtticRepositoryUpgrader, AtticKeyfileKey
 from ..helpers import get_keys_dir
 from ..helpers import get_keys_dir
 from ..key import KeyfileKey
 from ..key import KeyfileKey
 from ..remote import RemoteRepository
 from ..remote import RemoteRepository
-from ..repository import Repository, MAGIC
 
 
 
 
 def repo_valid(path):
 def repo_valid(path):
@@ -61,10 +58,12 @@ def attic_repo(tmpdir):
     attic_repo.close()
     attic_repo.close()
     return attic_repo
     return attic_repo
 
 
+
 @pytest.fixture(params=[True, False])
 @pytest.fixture(params=[True, False])
 def inplace(request):
 def inplace(request):
     return request.param
     return request.param
 
 
+
 @pytest.mark.skipif(attic is None, reason='cannot find an attic install')
 @pytest.mark.skipif(attic is None, reason='cannot find an attic install')
 def test_convert_segments(tmpdir, attic_repo, inplace):
 def test_convert_segments(tmpdir, attic_repo, inplace):
     """test segment conversion
     """test segment conversion
@@ -159,10 +158,13 @@ def test_convert_all(tmpdir, attic_repo, attic_key_file, inplace):
     """
     """
     # check should fail because of magic number
     # check should fail because of magic number
     assert not repo_valid(tmpdir)
     assert not repo_valid(tmpdir)
+
     def stat_segment(path):
     def stat_segment(path):
         return os.stat(os.path.join(path, 'data', '0', '0'))
         return os.stat(os.path.join(path, 'data', '0', '0'))
+
     def first_inode(path):
     def first_inode(path):
         return stat_segment(path).st_ino
         return stat_segment(path).st_ino
+
     orig_inode = first_inode(attic_repo.path)
     orig_inode = first_inode(attic_repo.path)
     repo = AtticRepositoryUpgrader(str(tmpdir), create=False)
     repo = AtticRepositoryUpgrader(str(tmpdir), create=False)
     # replicate command dispatch, partly
     # replicate command dispatch, partly
@@ -176,11 +178,12 @@ def test_convert_all(tmpdir, attic_repo, attic_key_file, inplace):
         assert first_inode(repo.path) != first_inode(backup)
         assert first_inode(repo.path) != first_inode(backup)
         # i have seen cases where the copied tree has world-readable
         # i have seen cases where the copied tree has world-readable
         # permissions, which is wrong
         # permissions, which is wrong
-        assert stat_segment(backup).st_mode & 0o007== 0
+        assert stat_segment(backup).st_mode & 0o007 == 0
 
 
     assert key_valid(attic_key_file.path)
     assert key_valid(attic_key_file.path)
     assert repo_valid(tmpdir)
     assert repo_valid(tmpdir)
 
 
+
 def test_hardlink(tmpdir, inplace):
 def test_hardlink(tmpdir, inplace):
     """test that we handle hard links properly
     """test that we handle hard links properly