This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
commit 88940740848b189843d3541a71ec8cf5fc063020
Author: Nir Soffer <nsoffer(a)redhat.com>
AuthorDate: Sun Jun 16 16:58:07 2019 +0300
python: Avoid star imports
Star Imports (from module import *) are very convenient but flake8 is
not smart enough to tell which names are imported. Replace the star
imports with specific imports.
This changes fixes these flake8 errors:
5 F403 'from .constants import *' used; unable to detect undefined
names
44 F405 'MiB' may be undefined, or defined from star imports:
.constants, .units
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
tests/daemon_test.py | 15 +++++++++++----
tests/direct_test.py | 2 +-
tests/python_test.py | 2 +-
tests/util.py | 2 +-
4 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/tests/daemon_test.py b/tests/daemon_test.py
index 36648e3..413ce95 100644
--- a/tests/daemon_test.py
+++ b/tests/daemon_test.py
@@ -9,9 +9,17 @@ import struct
import pytest
-from . constants import *
+from . constants import (
+ DELTA_DISK_MAGIC,
+ PAXOS_DISK_MAGIC,
+ PAXOS_DISK_CLEAR,
+ RINDEX_DISK_MAGIC,
+ RINDEX_ENTRIES_SECTORS,
+ RINDEX_ENTRY_SIZE
+)
+
from . import util
-from . units import *
+from . units import MiB
def test_single_instance(sanlock_daemon):
@@ -126,8 +134,7 @@ def test_create(tmpdir, sanlock_daemon):
# New entry should be created at the first slot
# The first rindex sector is used by the rindex header.
f.seek(MiB + 512)
- util.check_rindex_entry(f.read(RINDEX_ENTRY_SIZE),
- b"res", 3 * MiB, 0)
+ util.check_rindex_entry(f.read(RINDEX_ENTRY_SIZE), b"res", 3 * MiB, 0)
# The rest of the entries should not be modified.
rest = 512 * RINDEX_ENTRIES_SECTORS - RINDEX_ENTRY_SIZE
diff --git a/tests/direct_test.py b/tests/direct_test.py
index a157bc4..339ef51 100644
--- a/tests/direct_test.py
+++ b/tests/direct_test.py
@@ -8,7 +8,7 @@ import struct
from . import constants
from . import util
-from . units import *
+from . units import MiB
def test_init_lockspace(tmpdir):
diff --git a/tests/python_test.py b/tests/python_test.py
index 8822521..a032951 100644
--- a/tests/python_test.py
+++ b/tests/python_test.py
@@ -17,7 +17,7 @@ import sanlock
from . import constants
from . import util
-from . units import *
+from . units import KiB, MiB, GiB, TiB
# Largest file size on ext4 is 16TiB, and on xfs 500 TiB. Use 1 TiB as it is
diff --git a/tests/util.py b/tests/util.py
index 243b1d3..6a648c4 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -11,7 +11,7 @@ import struct
import subprocess
import time
-from . units import *
+from . units import KiB
TESTDIR = os.path.dirname(__file__)
SANLOCK = os.path.join(TESTDIR, os.pardir, "src", "sanlock")
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
Show replies by date