Skip to content

Commit 842f843

Browse files
author
Lukas Puehringer
committed
Remove duplicate testing simple_server.py
tests/simple_server.py was copied to tuf/scripts/ to "make testing easier" (cf84d3f), although with the current test setup the original (and recently patched to fix an Windows/Py2 test issue) test simple_server.py can be used just as well. This commit: - removes tuf/scripts/simple_server.py Note: that version slightly differed from the original test server, probably due to demands by the linter that is only executed on the tuf core code and not on the tests. However, for the testing purposes of simple_server.py these changes (i.e., `SystemRandom()`, `if __name__ =='__main__':`) are not necessary. - updates the tests that used tuf.scripts.simple_server to instead use tests.simple_server, - updates setup.py to not install the simple_server module as script, when installing tuf, as it is only a testing script and not meant for end-user usage. Signed-off-by: Lukas Puehringer <[email protected]>
1 parent 7dbb30a commit 842f843

File tree

4 files changed

+9
-76
lines changed

4 files changed

+9
-76
lines changed

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@
124124
packages = find_packages(exclude=['tests']),
125125
scripts = [
126126
'tuf/scripts/repo.py',
127-
'tuf/scripts/client.py',
128-
'tuf/scripts/simple_server.py',
127+
'tuf/scripts/client.py'
129128
]
130129
)

tests/test_multiple_repositories_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ def setUp(self):
128128
while self.SERVER_PORT == self.SERVER_PORT2:
129129
self.SERVER_PORT2 = random.SystemRandom().randint(30000, 45000)
130130

131-
command = ['python', '-m', 'tuf.scripts.simple_server', str(self.SERVER_PORT)]
132-
command2 = ['python', '-m', 'tuf.scripts.simple_server', str(self.SERVER_PORT2)]
131+
command = ['python', '-m', 'tests.simple_server', str(self.SERVER_PORT)]
132+
command2 = ['python', '-m', 'tests.simple_server', str(self.SERVER_PORT2)]
133133

134134
self.server_process = subprocess.Popen(command, stderr=subprocess.PIPE,
135135
cwd=self.repository_directory)

tests/test_updater.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def setUpClass(cls):
9898
# as a delegated role 'targets/role1', three target files, five key files,
9999
# etc.
100100
cls.SERVER_PORT = random.randint(30000, 45000)
101-
command = ['python', '-m', 'tuf.scripts.simple_server', str(cls.SERVER_PORT)]
101+
command = ['python', '-m', 'tests.simple_server', str(cls.SERVER_PORT)]
102102
cls.server_process = subprocess.Popen(command, stderr=subprocess.PIPE)
103103
logger.info('\n\tServer process started.')
104104
logger.info('\tServer process id: '+str(cls.server_process.pid))
@@ -1094,7 +1094,7 @@ def test_6_get_one_valid_targetinfo(self):
10941094
# The SimpleHTTPServer started in the setupclass has a tendency to
10951095
# timeout in Windows after a few tests.
10961096
SERVER_PORT = random.randint(30000, 45000)
1097-
command = ['python', '-m', 'tuf.scripts.simple_server', str(SERVER_PORT)]
1097+
command = ['python', '-m', 'tests.simple_server', str(SERVER_PORT)]
10981098
server_process = subprocess.Popen(command, stderr=subprocess.PIPE)
10991099

11001100
# NOTE: Following error is raised if a delay is not long enough:
@@ -1361,7 +1361,7 @@ def test_7_updated_targets(self):
13611361
# The SimpleHTTPServer started in the setupclass has a tendency to
13621362
# timeout in Windows after a few tests.
13631363
SERVER_PORT = random.randint(30000, 45000)
1364-
command = ['python', '-m', 'tuf.scripts.simple_server', str(SERVER_PORT)]
1364+
command = ['python', '-m', 'tests.simple_server', str(SERVER_PORT)]
13651365
server_process = subprocess.Popen(command, stderr=subprocess.PIPE)
13661366

13671367
# NOTE: Following error is raised if a delay is not long enough to allow
@@ -1493,7 +1493,7 @@ def test_8_remove_obsolete_targets(self):
14931493
# The SimpleHTTPServer started in the setupclass has a tendency to
14941494
# timeout in Windows after a few tests.
14951495
SERVER_PORT = random.randint(30000, 45000)
1496-
command = ['python', '-m', 'tuf.scripts.simple_server', str(SERVER_PORT)]
1496+
command = ['python', '-m', 'tests.simple_server', str(SERVER_PORT)]
14971497
server_process = subprocess.Popen(command, stderr=subprocess.PIPE)
14981498

14991499
# NOTE: Following error is raised if a delay is not long enough to allow
@@ -1877,8 +1877,8 @@ def setUp(self):
18771877
self.SERVER_PORT = 30001
18781878
self.SERVER_PORT2 = 30002
18791879

1880-
command = ['python', '-m', 'tuf.scripts.simple_server', str(self.SERVER_PORT)]
1881-
command2 = ['python', '-m', 'tuf.scripts.simple_server', str(self.SERVER_PORT2)]
1880+
command = ['python', '-m', 'tests.simple_server', str(self.SERVER_PORT)]
1881+
command2 = ['python', '-m', 'tests.simple_server', str(self.SERVER_PORT2)]
18821882

18831883
self.server_process = subprocess.Popen(command, stderr=subprocess.PIPE,
18841884
cwd=self.repository_directory)

tuf/scripts/simple_server.py

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)