[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] Clean up egg after unit tests
commit cd5bcc6ee1dfb6bffaab1bd4444335aa63e265ec
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Nov 11 13:28:46 2017 -0800
Clean up egg after unit tests
Our installation unit test results in a couple egg things. Cleaning those up
afterward.
---
run_tests.py | 9 ++++-----
test/__init__.py | 2 ++
test/installation.py | 6 ++++--
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/run_tests.py b/run_tests.py
index a9dd98a..0aeac4f 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -16,10 +16,9 @@ import stem.util.system
import stem.util.test_tools
import nyx
+import test
-NYX_BASE = os.path.dirname(__file__)
-
-SRC_PATHS = [os.path.join(NYX_BASE, path) for path in (
+SRC_PATHS = [os.path.join(test.NYX_BASE, path) for path in (
'nyx',
'test',
'run_tests.py',
@@ -32,9 +31,9 @@ SRC_PATHS = [os.path.join(NYX_BASE, path) for path in (
def main():
nyx.PAUSE_TIME = 0.000001 # make pauses negligibly low since our tests trigger things rapidly
test_config = stem.util.conf.get_config('test')
- test_config.load(os.path.join(NYX_BASE, 'test', 'settings.cfg'))
+ test_config.load(os.path.join(test.NYX_BASE, 'test', 'settings.cfg'))
- orphaned_pyc = stem.util.test_tools.clean_orphaned_pyc(NYX_BASE)
+ orphaned_pyc = stem.util.test_tools.clean_orphaned_pyc([test.NYX_BASE])
for path in orphaned_pyc:
print('Deleted orphaned pyc file: %s' % path)
diff --git a/test/__init__.py b/test/__init__.py
index 7f7f19d..b259f7b 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -4,6 +4,7 @@ Unit tests for nyx.
import collections
import inspect
+import os
import time
import unittest
@@ -28,6 +29,7 @@ __all__ = [
'tracker',
]
+NYX_BASE = os.path.sep.join(__file__.split(os.path.sep)[:-2])
OUR_SCREEN_SIZE = None
TEST_SCREEN_SIZE = nyx.curses.Dimensions(80, 25)
diff --git a/test/installation.py b/test/installation.py
index ee64e29..4b89177 100644
--- a/test/installation.py
+++ b/test/installation.py
@@ -6,6 +6,7 @@ import unittest
import nyx
import stem.util.system
+import test
class TestInstallation(unittest.TestCase):
@@ -35,7 +36,8 @@ class TestInstallation(unittest.TestCase):
self.assertTrue(stdout.startswith(b'Usage nyx [OPTION]'))
finally:
- if os.path.exists('/tmp/nyx_test'):
- shutil.rmtree('/tmp/nyx_test')
+ for path in ('/tmp/nyx_test', os.path.join(test.NYX_BASE, 'dist'), os.path.join(test.NYX_BASE, 'nyx.egg-info')):
+ if os.path.exists(path):
+ shutil.rmtree(path)
os.chdir(original_cwd)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits