[tests] kill running threads before quitting
This commit is contained in:
@@ -100,4 +100,10 @@ def get_random_file():
|
||||
return get_test_generic_package("random_file")
|
||||
|
||||
def get_random_file_md5():
|
||||
return get_test_generic_package("random_file.md5")
|
||||
return get_test_generic_package("random_file.md5")
|
||||
|
||||
def get_security_pkg():
|
||||
return get_test_generic_package("security-advisories.tar.bz2")
|
||||
|
||||
def get_security_pkg_asc():
|
||||
return get_test_generic_package("security-advisories.tar.bz2.asc")
|
||||
|
||||
@@ -13,6 +13,7 @@ from entropy.const import etpConst, etpUi
|
||||
from entropy.core.settings.base import SystemSettings
|
||||
from entropy.db import EntropyRepository
|
||||
from entropy.exceptions import RepositoryError
|
||||
import entropy.tools
|
||||
import tests._misc as _misc
|
||||
|
||||
class EntropyRepositoryTest(unittest.TestCase):
|
||||
@@ -180,3 +181,4 @@ if __name__ == '__main__':
|
||||
from entropy.const import etpUi
|
||||
etpUi['debug'] = True
|
||||
unittest.main()
|
||||
entropy.tools.kill_threads()
|
||||
|
||||
@@ -447,3 +447,4 @@ if __name__ == '__main__':
|
||||
from entropy.const import etpUi
|
||||
etpUi['debug'] = True
|
||||
unittest.main()
|
||||
entropy.tools.kill_threads()
|
||||
|
||||
@@ -7,6 +7,7 @@ import unittest
|
||||
import tests._misc as _misc
|
||||
from entropy.fetchers import UrlFetcher, MultipleUrlFetcher
|
||||
from entropy.const import etpUi
|
||||
import entropy.tools
|
||||
|
||||
class FetchersTest(unittest.TestCase):
|
||||
|
||||
@@ -61,3 +62,4 @@ if __name__ == '__main__':
|
||||
from entropy.const import etpUi
|
||||
etpUi['debug'] = True
|
||||
unittest.main()
|
||||
entropy.tools.kill_threads()
|
||||
|
||||
BIN
libraries/tests/packages/security-advisories.tar.bz2
Normal file
BIN
libraries/tests/packages/security-advisories.tar.bz2
Normal file
Binary file not shown.
11
libraries/tests/packages/security-advisories.tar.bz2.asc
Normal file
11
libraries/tests/packages/security-advisories.tar.bz2.asc
Normal file
@@ -0,0 +1,11 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.10 (GNU/Linux)
|
||||
|
||||
iQEcBAABAgAGBQJLaf/2AAoJEDc1BZKvIvC/G70IAKThaWt4KCO8B07hHFNWlrTi
|
||||
pLJuX/8Hqg7KCcX+42Rlt04brysusDHlR3Z/mv2uuMR4PcBR1P5Kd+aiT4F/rXzm
|
||||
6f5IDBAmGMkzyUu0QzZ0yVmfdPW8L/52izuMT+AZdIH0l/YkCAsdasvUKSXrKwIR
|
||||
4RSY9nr3+2+fETmDiADeKoAlcqm01WVTk4FSvIJGsU5kRRrgCOQ63zrxNmM14sT5
|
||||
kb+g3vYzww8O5D4+j2Svqj5sqlEJNNVRh1berEfW6fy5zNeAUu+bgepO8cRhS2EQ
|
||||
tmkc+F+qTC1C7Re2S1aOueWjq6pMK9KmX1SrooKQyToDrEtlJm4DSlrMs70qeLM=
|
||||
=E4zH
|
||||
-----END PGP SIGNATURE-----
|
||||
1
libraries/tests/packages/security-advisories.tar.bz2.md5
Normal file
1
libraries/tests/packages/security-advisories.tar.bz2.md5
Normal file
@@ -0,0 +1 @@
|
||||
6c5b604bf02042718fb5c60f9b990eb7 security-advisories.tar.bz2
|
||||
@@ -5,6 +5,7 @@ sys.path.insert(0, '../')
|
||||
import unittest
|
||||
import entropy.qa
|
||||
from entropy.output import TextInterface
|
||||
import entropy.tools
|
||||
import tests._misc as _misc
|
||||
import tempfile
|
||||
|
||||
@@ -38,3 +39,4 @@ if __name__ == '__main__':
|
||||
from entropy.const import etpUi
|
||||
etpUi['debug'] = True
|
||||
unittest.main()
|
||||
entropy.tools.kill_threads()
|
||||
@@ -13,6 +13,7 @@ sys.path.insert(0,'.')
|
||||
sys.path.insert(0,'../')
|
||||
# set unit testing mode
|
||||
from entropy.const import etpSys, etpUi
|
||||
import entropy.tools
|
||||
etpSys['unittest'] = True
|
||||
if "--debug" in sys.argv:
|
||||
sys.argv.remove("--debug")
|
||||
@@ -33,4 +34,5 @@ for mod in mods:
|
||||
result = unittest.TextTestRunner(verbosity = 1).run(unittest.TestSuite(tests))
|
||||
if result.errors:
|
||||
rc = 1
|
||||
entropy.tools.kill_threads()
|
||||
raise SystemExit(rc)
|
||||
|
||||
@@ -8,7 +8,10 @@ import os
|
||||
import unittest
|
||||
import tempfile
|
||||
import shutil
|
||||
from entropy.security import Repository
|
||||
from entropy.const import etpConst
|
||||
from entropy.client.interfaces import Client
|
||||
from entropy.security import Repository, System
|
||||
import entropy.tools
|
||||
import tests._misc as _misc
|
||||
|
||||
class SecurityTest(unittest.TestCase):
|
||||
@@ -19,6 +22,16 @@ class SecurityTest(unittest.TestCase):
|
||||
"""
|
||||
self._tmp_dir = tempfile.mkdtemp()
|
||||
self._repository = Repository(keystore_dir = self._tmp_dir)
|
||||
self._entropy = Client()
|
||||
|
||||
self._security_cache_dir = tempfile.mkdtemp()
|
||||
self._security_dir = tempfile.mkdtemp()
|
||||
System.SECURITY_DIR = self._security_dir
|
||||
System._CACHE_DIR = self._security_cache_dir
|
||||
System.SECURITY_URL = "file://" + _misc.get_security_pkg()
|
||||
self._system = System(self._entropy)
|
||||
# set fake security url
|
||||
|
||||
sys.stdout.write("%s called\n" % (self,))
|
||||
sys.stdout.flush()
|
||||
|
||||
@@ -26,11 +39,33 @@ class SecurityTest(unittest.TestCase):
|
||||
"""
|
||||
tearDown is run after each test
|
||||
"""
|
||||
self._entropy.destroy()
|
||||
del self._entropy
|
||||
del self._repository
|
||||
del self._system
|
||||
shutil.rmtree(self._tmp_dir, True)
|
||||
shutil.rmtree(self._security_dir, True)
|
||||
shutil.rmtree(self._security_cache_dir, True)
|
||||
sys.stdout.write("%s ran\n" % (self,))
|
||||
sys.stdout.flush()
|
||||
|
||||
def test_security_get_advisories_cache(self):
|
||||
self.assertEqual(self._system.get_advisories_cache(), None)
|
||||
|
||||
def test_security_set_advisories_cache(self):
|
||||
self.assertEqual(self._system.get_advisories_cache(), None)
|
||||
self._system.set_advisories_cache({'zomg': True})
|
||||
self.assertEqual(self._system.get_advisories_cache(), {'zomg': True})
|
||||
|
||||
def test_security_get_advisories_metadata(self):
|
||||
meta = self._system.get_advisories_metadata()
|
||||
# this should be empty
|
||||
self.assertEqual(meta, {})
|
||||
|
||||
def test_security_fetch_advisories(self):
|
||||
s_rc = self._system.sync()
|
||||
self.assertEqual(s_rc, 0)
|
||||
|
||||
def test_gpg_handling(self):
|
||||
|
||||
# available keys should be empty
|
||||
@@ -79,3 +114,4 @@ if __name__ == '__main__':
|
||||
from entropy.const import etpUi
|
||||
etpUi['debug'] = True
|
||||
unittest.main()
|
||||
entropy.tools.kill_threads()
|
||||
@@ -10,6 +10,7 @@ from entropy.const import etpConst
|
||||
from entropy.core.settings.base import SystemSettings
|
||||
from entropy.db import EntropyRepository
|
||||
from entropy.exceptions import RepositoryError
|
||||
import entropy.tools
|
||||
import tests._misc as _misc
|
||||
|
||||
class EntropyRepositoryTest(unittest.TestCase):
|
||||
@@ -61,3 +62,4 @@ if __name__ == '__main__':
|
||||
from entropy.const import etpUi
|
||||
etpUi['debug'] = True
|
||||
unittest.main()
|
||||
entropy.tools.kill_threads()
|
||||
|
||||
@@ -145,3 +145,4 @@ if __name__ == '__main__':
|
||||
from entropy.const import etpUi
|
||||
etpUi['debug'] = True
|
||||
unittest.main()
|
||||
et.kill_threads()
|
||||
|
||||
@@ -708,3 +708,4 @@ if __name__ == '__main__':
|
||||
from entropy.const import etpUi
|
||||
etpUi['debug'] = True
|
||||
unittest.main()
|
||||
et.kill_threads()
|
||||
|
||||
Reference in New Issue
Block a user