From 0b52b75dbf25958e55a35fc25353e990f354cf19 Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Wed, 10 Apr 2019 18:03:58 -0700 Subject: [PATCH] Optimize imports in test classes --- tests/test_hierarchy.py | 7 +++++-- tests/test_packagemanager.py | 10 +++------- tests/test_repository.py | 7 +++---- tests/test_snapshot.py | 3 ++- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/test_hierarchy.py b/tests/test_hierarchy.py index 03bf859..9e75df1 100644 --- a/tests/test_hierarchy.py +++ b/tests/test_hierarchy.py @@ -1,9 +1,12 @@ import json import unittest +from io import StringIO +from pathlib import Path +from unittest.mock import PropertyMock, patch from hypothesis import given -from hypothesis.strategies import booleans, characters, iterables, one_of, none, text -from pathlib import Path +from hypothesis.strategies import characters, one_of, lists, text + from rbackup.struct.hierarchy import Hierarchy # ========== Constants ========== diff --git a/tests/test_packagemanager.py b/tests/test_packagemanager.py index 30a64a8..544a6b7 100644 --- a/tests/test_packagemanager.py +++ b/tests/test_packagemanager.py @@ -2,24 +2,20 @@ .. author:: Eric Torres :synopsis: Unit tests for the PackageManager module. """ -import doctest import subprocess import unittest +from pathlib import Path +from unittest.mock import patch from hypothesis import given from hypothesis.strategies import ( - booleans, - dictionaries, from_regex, - integers, iterables, one_of, - none, text, ) -from pathlib import Path + from rbackup.package_managers.packagemanager import PackageManager -from unittest.mock import patch # ========== Constants ========== TESTING_MODULE = "rbackup.package_managers.packagemanager" diff --git a/tests/test_repository.py b/tests/test_repository.py index cce6181..2e777f4 100644 --- a/tests/test_repository.py +++ b/tests/test_repository.py @@ -1,12 +1,11 @@ -# import doctest import unittest +from unittest.mock import MagicMock, PropertyMock, patch from hypothesis import given -from hypothesis.strategies import builds, lists, text -from pathlib import Path +from hypothesis.strategies import builds, characters, lists, text + from rbackup.struct.repository import Repository from rbackup.struct.snapshot import Snapshot -from unittest.mock import MagicMock, PropertyMock, patch # ========== Constants ========== TESTING_PACKAGE = "rbackup.struct" diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py index edf0670..422db7d 100644 --- a/tests/test_snapshot.py +++ b/tests/test_snapshot.py @@ -9,7 +9,8 @@ import unittest from rbackup.struct.snapshot import Snapshot # ========== Constants ========== -TESTING_MODULE = "rbackup.struct.snapshot" +TESTING_PACKAGE = "rbackup.struct" +TESTING_MODULE = f"{TESTING_PACKAGE}.snapshot"