summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/requirements-testing.pip3
-rw-r--r--setup.cfg2
-rw-r--r--src/leap/common/events/tests/__init__.py0
-rw-r--r--src/leap/common/tests/__init__.py0
-rw-r--r--tests/config/test_baseconfig.py (renamed from src/leap/common/config/tests/test_baseconfig.py)18
-rw-r--r--tests/config/test_get_path_prefix.py (renamed from src/leap/common/config/tests/test_get_path_prefix.py)2
-rw-r--r--tests/events/test_auth.py (renamed from src/leap/common/events/tests/test_auth.py)3
-rw-r--r--tests/events/test_events.py (renamed from src/leap/common/events/tests/test_events.py)0
-rw-r--r--tests/events/test_zmq_components.py (renamed from src/leap/common/events/tests/test_zmq_components.py)0
-rw-r--r--tests/test_certs.py (renamed from src/leap/common/tests/test_certs.py)10
-rw-r--r--tests/test_check.py (renamed from src/leap/common/tests/test_check.py)0
-rw-r--r--tests/test_http.py (renamed from src/leap/common/tests/test_http.py)6
-rw-r--r--tests/test_memoize.py (renamed from src/leap/common/tests/test_memoize.py)0
-rw-r--r--tests/testing/test_basetest.py (renamed from src/leap/common/testing/test_basetest.py)4
-rw-r--r--tox.ini17
15 files changed, 36 insertions, 29 deletions
diff --git a/pkg/requirements-testing.pip b/pkg/requirements-testing.pip
deleted file mode 100644
index c5a3ad0..0000000
--- a/pkg/requirements-testing.pip
+++ /dev/null
@@ -1,3 +0,0 @@
-mock
-setuptools-trial
-pep8
diff --git a/setup.cfg b/setup.cfg
index 7828918..431f4b9 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
[aliases]
-test = trial
+test=pytest
[pep8]
exclude = versioneer.py,_version.py,*.egg,build,dist,docs
diff --git a/src/leap/common/events/tests/__init__.py b/src/leap/common/events/tests/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/src/leap/common/events/tests/__init__.py
+++ /dev/null
diff --git a/src/leap/common/tests/__init__.py b/src/leap/common/tests/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/src/leap/common/tests/__init__.py
+++ /dev/null
diff --git a/src/leap/common/config/tests/test_baseconfig.py b/tests/config/test_baseconfig.py
index e17e82d..22358ec 100644
--- a/src/leap/common/config/tests/test_baseconfig.py
+++ b/tests/config/test_baseconfig.py
@@ -100,7 +100,7 @@ sample_spec = {
}
-class TestConfig(BaseConfig):
+class Config(BaseConfig):
"""
BaseConfig implementation for testing purposes only.
"""
@@ -149,16 +149,16 @@ class BaseConfigTest(BaseLeapTest):
def _get_config(self, fromfile=False, data=sample_config):
"""
- Helper that returns a TestConfig object using the data parameter
+ Helper that returns a Config object using the data parameter
or a sample data.
:param fromfile: sets if we should use a file or a string
:fromfile type: bool
- :param data: sets the data to be used to load in the TestConfig object
+ :param data: sets the data to be used to load in the Config object
:data type: dict (valid json)
- :rtype: TestConfig
+ :rtype: Config
"""
- config = TestConfig()
+ config = Config()
loaded = False
if fromfile:
@@ -198,7 +198,7 @@ class BaseConfigTest(BaseLeapTest):
self.assertEqual(config.get_gateways(), sample_config["gateways"])
def test_safe_get_value_no_config(self):
- config = TestConfig()
+ config = Config()
with self.assertRaises(AssertionError):
config.get_version()
@@ -213,7 +213,7 @@ class BaseConfigTest(BaseLeapTest):
self.assertTrue(config.loaded())
def test_not_loaded(self):
- config = TestConfig()
+ config = Config()
self.assertFalse(config.loaded())
def test_save_and_load(self):
@@ -222,7 +222,7 @@ class BaseConfigTest(BaseLeapTest):
config_file = 'test_config.json'
self.assertTrue(config.save([config_file]))
- config_saved = TestConfig()
+ config_saved = Config()
config_file_path = self.get_tempfile(config_file)
self.assertTrue(config_saved.load(config_file_path, relative=False))
@@ -243,7 +243,7 @@ class BaseConfigTest(BaseLeapTest):
conf = copy.deepcopy(sample_config)
conf['default_language'] = lang
json_string = json.dumps(conf)
- config = TestConfig()
+ config = Config()
config.load(data=json_string)
return config
diff --git a/src/leap/common/config/tests/test_get_path_prefix.py b/tests/config/test_get_path_prefix.py
index 27824fc..e383a7e 100644
--- a/src/leap/common/config/tests/test_get_path_prefix.py
+++ b/tests/config/test_get_path_prefix.py
@@ -36,7 +36,7 @@ class GetPathPrefixTest(BaseLeapTest):
Note: we only are testing that the path is correctly returned and that if
we are not in a bundle (standalone=False) then the paths are different.
- dirspec calculates the correct path using different methods and dlls
+ xdg calculates the correct path using different methods and dlls
(in case of Windows) so we don't implement tests to check if the paths
are the correct ones.
"""
diff --git a/src/leap/common/events/tests/test_auth.py b/tests/events/test_auth.py
index 78ffd9f..5442ebd 100644
--- a/src/leap/common/events/tests/test_auth.py
+++ b/tests/events/test_auth.py
@@ -33,8 +33,6 @@ from txzmq.test import _wait
class ZmqAuthTestCase(unittest.TestCase, BaseLeapTest):
def setUp(self):
- self.setUpEnv(launch_events_server=False)
-
self.factory = ZmqFactory()
self._config_prefix = os.path.join(self.tempdir, "leap", "events")
@@ -47,7 +45,6 @@ class ZmqAuthTestCase(unittest.TestCase, BaseLeapTest):
def tearDown(self):
self.factory.shutdown()
- self.tearDownEnv()
def test_curve_auth(self):
self.auth_req.start()
diff --git a/src/leap/common/events/tests/test_events.py b/tests/events/test_events.py
index d8435c6..d8435c6 100644
--- a/src/leap/common/events/tests/test_events.py
+++ b/tests/events/test_events.py
diff --git a/src/leap/common/events/tests/test_zmq_components.py b/tests/events/test_zmq_components.py
index c51e37e..c51e37e 100644
--- a/src/leap/common/events/tests/test_zmq_components.py
+++ b/tests/events/test_zmq_components.py
diff --git a/src/leap/common/tests/test_certs.py b/tests/test_certs.py
index 8ebc0f4..b06fbf8 100644
--- a/src/leap/common/tests/test_certs.py
+++ b/tests/test_certs.py
@@ -18,7 +18,6 @@
Tests for:
* leap/common/certs.py
"""
-import os
import time
try:
@@ -28,10 +27,9 @@ except ImportError:
from leap.common import certs
from leap.common.testing.basetest import BaseLeapTest
+from leap.common.testing.https_server import where
-TEST_CERT_PEM = os.path.join(
- os.path.split(__file__)[0],
- '..', 'testing', "leaptest_combined_keycert.pem")
+TEST_CERT_PEM = where("leaptest_combined_keycert.pem")
# Values from the test cert file:
# Not Before: Sep 3 17:52:16 2013 GMT
@@ -43,10 +41,10 @@ CERT_NOT_AFTER = (2023, 9, 1, 17, 52, 16, 4, 244, 0)
class CertsTest(BaseLeapTest):
def setUp(self):
- self.setUpEnv()
+ pass
def tearDown(self):
- self.tearDownEnv()
+ pass
def test_should_redownload_if_no_cert(self):
self.assertTrue(certs.should_redownload(certfile=""))
diff --git a/src/leap/common/tests/test_check.py b/tests/test_check.py
index cd488ff..cd488ff 100644
--- a/src/leap/common/tests/test_check.py
+++ b/tests/test_check.py
diff --git a/src/leap/common/tests/test_http.py b/tests/test_http.py
index f44550f..d5526e6 100644
--- a/src/leap/common/tests/test_http.py
+++ b/tests/test_http.py
@@ -18,7 +18,6 @@
Tests for:
* leap/common/http.py
"""
-import os
try:
import unittest2 as unittest
except ImportError:
@@ -26,10 +25,9 @@ except ImportError:
from leap.common import http
from leap.common.testing.basetest import BaseLeapTest
+from leap.common.testing.https_server import where
-TEST_CERT_PEM = os.path.join(
- os.path.split(__file__)[0],
- '..', 'testing', "leaptest_combined_keycert.pem")
+TEST_CERT_PEM = where("leaptest_combined_keycert.pem")
class HTTPClientTest(BaseLeapTest):
diff --git a/src/leap/common/tests/test_memoize.py b/tests/test_memoize.py
index c923fc5..c923fc5 100644
--- a/src/leap/common/tests/test_memoize.py
+++ b/tests/test_memoize.py
diff --git a/src/leap/common/testing/test_basetest.py b/tests/testing/test_basetest.py
index ec42a62..8be7aba 100644
--- a/src/leap/common/testing/test_basetest.py
+++ b/tests/testing/test_basetest.py
@@ -83,10 +83,10 @@ class TestInitBaseLeapTest(BaseLeapTest):
"""
def setUp(self):
- self.setUpEnv()
+ pass
def tearDown(self):
- self.tearDownEnv()
+ pass
def test_path_is_changed(self):
"""tests whether we have changed the PATH env var"""
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..5ca1ca4
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,17 @@
+# Tox (http://tox.testrun.org/) is a tool for running tests
+# in multiple virtualenvs. This configuration file will run the
+# test suite on all supported python versions. To use it, "pip install tox"
+# and then run "tox" from this directory.
+
+[tox]
+envlist = py27
+
+[testenv]
+commands = py.test {posargs}
+deps =
+ pytest
+ mock
+ setuptools-trial
+ pep8
+setenv =
+ HOME=/tmp