Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix imports and default value for function arg #1216

Merged
merged 2 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta

import utils
from tests import utils

# TODO: Remove case handling when fully dropping support for versions >= 3.6
IS_PY_VERSION_SUPPORTED = sys.version_info >= (3, 6)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_arbitrary_package_attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import tuf.client.updater as updater
import tuf.unittest_toolbox as unittest_toolbox

import utils
from tests import utils

import securesystemslib
import six
Expand Down
2 changes: 1 addition & 1 deletion tests/test_developer_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from tuf.developer_tool import METADATA_DIRECTORY_NAME
from tuf.developer_tool import TARGETS_DIRECTORY_NAME

import utils
from tests import utils

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import tuf.unittest_toolbox as unittest_toolbox
import tuf.exceptions

import utils
from tests import utils

import requests.exceptions

Expand Down
2 changes: 1 addition & 1 deletion tests/test_endless_data_attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import tuf.unittest_toolbox as unittest_toolbox
import tuf.roledb

import utils
from tests import utils

import securesystemslib
import six
Expand Down
2 changes: 1 addition & 1 deletion tests/test_extraneous_dependencies_attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
import tuf.keydb
import tuf.unittest_toolbox as unittest_toolbox

import utils
from tests import utils

import securesystemslib
import six
Expand Down
2 changes: 1 addition & 1 deletion tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import tuf
import tuf.formats

import utils
from tests import utils

import securesystemslib
import securesystemslib.util
Expand Down
2 changes: 1 addition & 1 deletion tests/test_indefinite_freeze_attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
import tuf.keydb
import tuf.exceptions

import utils
from tests import utils

import securesystemslib
import six
Expand Down
2 changes: 1 addition & 1 deletion tests/test_key_revocation_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import tuf.unittest_toolbox as unittest_toolbox
import tuf.client.updater as updater

import utils
from tests import utils

import securesystemslib
import six
Expand Down
2 changes: 1 addition & 1 deletion tests/test_keydb.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import tuf.keydb
import tuf.log

import utils
from tests import utils

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import securesystemslib
import securesystemslib.util

import utils
from tests import utils

from six.moves import reload_module

Expand Down
2 changes: 1 addition & 1 deletion tests/test_mirrors.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import tuf.mirrors as mirrors
import tuf.unittest_toolbox as unittest_toolbox

import utils
from tests import utils

import securesystemslib
import securesystemslib.util
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mix_and_match_attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import tuf.roledb
import tuf.keydb

import utils
from tests import utils

import six

Expand Down
2 changes: 1 addition & 1 deletion tests/test_multiple_repositories_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import tuf.unittest_toolbox as unittest_toolbox
import tuf.repository_tool as repo_tool

import utils
from tests import utils

import six
import securesystemslib
Expand Down
2 changes: 1 addition & 1 deletion tests/test_proxy_use.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import tuf.unittest_toolbox as unittest_toolbox
import tuf.exceptions

import utils
from tests import utils

import six

Expand Down
2 changes: 1 addition & 1 deletion tests/test_replay_attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import tuf.repository_tool as repo_tool
import tuf.unittest_toolbox as unittest_toolbox

import utils
from tests import utils

import securesystemslib
import six
Expand Down
2 changes: 1 addition & 1 deletion tests/test_repository_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
import tuf.repository_lib as repo_lib
import tuf.repository_tool as repo_tool

import utils
from tests import utils

import securesystemslib
import securesystemslib.exceptions
Expand Down
2 changes: 1 addition & 1 deletion tests/test_repository_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import tuf.keydb
import tuf.repository_tool as repo_tool

import utils
from tests import utils

import securesystemslib
import securesystemslib.exceptions
Expand Down
2 changes: 1 addition & 1 deletion tests/test_roledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import tuf.exceptions
import tuf.log

import utils
from tests import utils

import securesystemslib
import securesystemslib.keys
Expand Down
2 changes: 1 addition & 1 deletion tests/test_root_versioning_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import tuf.keydb
import tuf.repository_tool as repo_tool

import utils
from tests import utils

import securesystemslib
import securesystemslib.storage
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sig.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import tuf.sig
import tuf.exceptions

import utils
from tests import utils

import securesystemslib
import securesystemslib.keys
Expand Down
2 changes: 1 addition & 1 deletion tests/test_slow_retrieval_attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
import tuf.roledb
import tuf.keydb

import utils
from tests import utils

import six

Expand Down
2 changes: 1 addition & 1 deletion tests/test_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

from tuf.repository_tool import * # part of TUTORIAL.md

import utils
from tests import utils

import securesystemslib.exceptions

Expand Down
2 changes: 1 addition & 1 deletion tests/test_unittest_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import tuf.unittest_toolbox as unittest_toolbox

import utils
from tests import utils

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
import tuf.unittest_toolbox as unittest_toolbox
import tuf.client.updater as updater

import utils
from tests import utils

import securesystemslib
import six
Expand Down
2 changes: 1 addition & 1 deletion tests/test_updater_root_rotation_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
import tuf.client.updater as updater
import tuf.settings

import utils
from tests import utils

import securesystemslib
import six
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import tuf.unittest_toolbox as unittest_toolbox

import utils
from tests import utils

logger = logging.getLogger(__name__)

Expand Down
6 changes: 4 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,19 @@ class TestServerProcess():
List of additional arguments for the command
which will start the subprocess.
More precisely "python -u <path_to_server> <port> <extra_cmd_args>".
Default is empty list.
When no list is provided, an empty list ("[]") will be assigned to it.
"""


def __init__(self, log, server='simple_server.py',
timeout=10, popen_cwd=".", extra_cmd_args=[]):
timeout=10, popen_cwd=".", extra_cmd_args=None):

self.server = server
self.__logger = log
# Stores popped messages from the queue.
self.__logged_messages = []
if extra_cmd_args is None:
extra_cmd_args = []

try:
self._start_server(timeout, extra_cmd_args, popen_cwd)
Expand Down