diff --git a/tuf/tests/system_tests/slow_retrieval_server.py b/tuf/tests/system_tests/slow_retrieval_server.py index 0887d119..161277b6 100755 --- a/tuf/tests/system_tests/slow_retrieval_server.py +++ b/tuf/tests/system_tests/slow_retrieval_server.py @@ -24,11 +24,9 @@ import random from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer - DELAY = 1 - # HTTP request handler. class Handler(BaseHTTPRequestHandler): @@ -76,4 +74,4 @@ def run(port): else: port = get_random_port() - run(port) \ No newline at end of file + run(port) diff --git a/tuf/tests/system_tests/test_arbitrary_package_attack.py b/tuf/tests/system_tests/test_arbitrary_package_attack.py index 1ddcb053..b5f207ce 100755 --- a/tuf/tests/system_tests/test_arbitrary_package_attack.py +++ b/tuf/tests/system_tests/test_arbitrary_package_attack.py @@ -40,11 +40,6 @@ -# Disable logging. -util_test_tools.disable_logging() - - - class ArbitraryPackageAlert(Exception): pass @@ -149,4 +144,4 @@ def test_arbitrary_package_attack(TUF=False): test_arbitrary_package_attack(TUF=True) except ArbitraryPackageAlert, error: - print error \ No newline at end of file + print error diff --git a/tuf/tests/system_tests/test_endless_data_attack.py b/tuf/tests/system_tests/test_endless_data_attack.py index 9366accf..4cac5531 100755 --- a/tuf/tests/system_tests/test_endless_data_attack.py +++ b/tuf/tests/system_tests/test_endless_data_attack.py @@ -43,12 +43,6 @@ from tuf.interposition import urllib_tuf - -# Disable logging. -util_test_tools.disable_logging() - - - class EndlessDataAttack(Exception): pass diff --git a/tuf/tests/system_tests/test_extraneous_dependencies_attack.py b/tuf/tests/system_tests/test_extraneous_dependencies_attack.py index 72937d65..de327ea7 100755 --- a/tuf/tests/system_tests/test_extraneous_dependencies_attack.py +++ b/tuf/tests/system_tests/test_extraneous_dependencies_attack.py @@ -27,18 +27,17 @@ import tempfile import time -import util_test_tools +import tuf +import tuf.formats +import tuf.tests.system_tests.util_test_tools import tuf.repo.keystore import tuf.repo.signerlib as signerlib import tuf.repo.signercli as signercli from tuf.interposition import urllib_tuf - -# Disable logging. -util_test_tools.disable_logging() - version = 1 + class ExtraneousDependenciesAttackAlert(Exception): pass diff --git a/tuf/tests/system_tests/test_indefinite_freeze_attack.py b/tuf/tests/system_tests/test_indefinite_freeze_attack.py index 9a5bb1a0..85f457d2 100755 --- a/tuf/tests/system_tests/test_indefinite_freeze_attack.py +++ b/tuf/tests/system_tests/test_indefinite_freeze_attack.py @@ -27,21 +27,16 @@ import tempfile import util_test_tools +import tuf import tuf.formats import tuf.repo.signerlib as signerlib from tuf.interposition import urllib_tuf -# Disable logging. -util_test_tools.disable_logging() - - - class IndefiniteFreezeAttackAlert(Exception): pass - EXPIRATION = 1 # second(s) version = 1 diff --git a/tuf/tests/system_tests/test_mix_and_match_attack.py b/tuf/tests/system_tests/test_mix_and_match_attack.py index 94c40057..29ee9fcf 100755 --- a/tuf/tests/system_tests/test_mix_and_match_attack.py +++ b/tuf/tests/system_tests/test_mix_and_match_attack.py @@ -44,11 +44,6 @@ from tuf.interposition import urllib_tuf -# Disable logging. -util_test_tools.disable_logging() - - - class MixAndMatchAttackAlert(Exception): pass @@ -195,4 +190,4 @@ def test_mix_and_match_attack(TUF=False): try: test_mix_and_match_attack(TUF=True) except MixAndMatchAttackAlert, error: - print error \ No newline at end of file + print error diff --git a/tuf/tests/system_tests/test_replay_attack.py b/tuf/tests/system_tests/test_replay_attack.py index 4250a854..1c190dfa 100755 --- a/tuf/tests/system_tests/test_replay_attack.py +++ b/tuf/tests/system_tests/test_replay_attack.py @@ -38,16 +38,10 @@ import urllib import tempfile -import util_test_tools +import tuf.tests.system_tests.util_test_tools as util_test_tools from tuf.interposition import urllib_tuf - -# Disable logging. -util_test_tools.disable_logging() - - - class TestSetupError(Exception): pass @@ -189,4 +183,4 @@ def test_replay_attack(TUF=False): try: test_replay_attack(TUF=True) except ReplayAttackAlert, error: - print error \ No newline at end of file + print error diff --git a/tuf/tests/system_tests/test_slow_retrieval_attack.py b/tuf/tests/system_tests/test_slow_retrieval_attack.py index d2f9f4d9..7d25a7d2 100755 --- a/tuf/tests/system_tests/test_slow_retrieval_attack.py +++ b/tuf/tests/system_tests/test_slow_retrieval_attack.py @@ -42,15 +42,10 @@ import subprocess from multiprocessing import Process -import util_test_tools +import tuf.tests.system_tests.util_test_tools as util_test_tools from tuf.interposition import urllib_tuf -# Disable logging. -util_test_tools.disable_logging() - - - class SlowRetrievalAttackAlert(Exception): pass @@ -72,7 +67,8 @@ def test_slow_retrieval_attack(TUF=False): # Launch the server. port = random.randint(30000, 45000) command = ['python', 'slow_retrieval_server.py', str(port)] - server_process = subprocess.Popen(command, stderr=subprocess.PIPE) + server_process = subprocess.Popen(command, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) time.sleep(.1) try: @@ -134,4 +130,4 @@ def test_slow_retrieval_attack(TUF=False): try: test_slow_retrieval_attack(TUF=True) except SlowRetrievalAttackAlert, error: - print error \ No newline at end of file + print error diff --git a/tuf/tests/system_tests/util_test_tools.py b/tuf/tests/system_tests/util_test_tools.py index 969913db..40024a42 100755 --- a/tuf/tests/system_tests/util_test_tools.py +++ b/tuf/tests/system_tests/util_test_tools.py @@ -147,12 +147,6 @@ logger = logging.getLogger('tuf.tests.system_tests.util_test_tools') -# Disable logging for cleaner output. -def disable_logging(): - logging.getLogger('tuf') - logging.disable(logging.CRITICAL) - - PASSWD = 'test' version = 1 diff --git a/tuf/tests/unittest_toolbox.py b/tuf/tests/unittest_toolbox.py index 02247f8f..673c8ceb 100755 --- a/tuf/tests/unittest_toolbox.py +++ b/tuf/tests/unittest_toolbox.py @@ -158,12 +158,6 @@ def setUp(self): def tearDown(self): - # Removing 'tuf.log' file from current working directory. - """ - tuf_log_path = os.path.join(os.getcwd(), 'tuf.log') - if os.path.exists(tuf_log_path): - os.unlink(tuf_log_path) - """ for cleanup_function in self._cleanup: # Perform clean up by executing clean-up functions. try: