Commit 8292c742 by John Eskew

Convert to pytest and tox.

parent 8228553c
......@@ -4,8 +4,8 @@ test: test_no_proxy test_proxy
test_no_proxy:
@echo "Running all tests with no proxy process"
CODEJAIL_PROXY=0 nosetests
CODEJAIL_PROXY=0 pytest
test_proxy:
@echo "Running all tests with proxy process"
CODEJAIL_PROXY=1 nosetests
CODEJAIL_PROXY=1 pytest
......@@ -46,7 +46,7 @@ class JailMixin(TestCase):
current virtualenv with -sandbox appended and the user named `'sandbox'`.
"""
_codejail_venv = os.environ.get('CODEJAIL_TEST_VENV')
_codejail_venv = os.environ.get('CODEJAIL_TEST_VENV', os.environ.get('VIRTUAL_ENV'))
_codejail_user = os.environ.get('CODEJAIL_TEST_USER', 'sandbox')
def setUp(self):
......
DEBUG = True
SECRET_KEY = 'ThisIsASecretKey'
......@@ -12,7 +12,7 @@ import time
import unittest
import mock
from nose.plugins.skip import SkipTest
import pytest
from codejail.jail import JailResult
from codejail.jail_code import jail_code
......@@ -540,17 +540,11 @@ class TestMalware(JailCodeMixin, unittest.TestCase):
self.assertEqual(res.stdout, "Done.\n")
@pytest.mark.skipif(not int(os.environ.get("CODEJAIL_PROXY", "0")),
reason="Aren't using the codejail proxy.")
class TestProxyProcess(JailCodeMixin, unittest.TestCase):
"""Tests of the proxy process."""
def setUp(self):
# During testing, the proxy is used if the environment variable is set.
# Skip these tests if we aren't using the proxy.
if not int(os.environ.get("CODEJAIL_PROXY", "0")):
raise SkipTest("No proxy configured")
super(TestProxyProcess, self).setUp()
def run_ok(self):
"""Run some code to see that it works."""
num = int(time.time()*100000)
......
[pytest]
python_paths = codejail
DJANGO_SETTINGS_MODULE = tests.settings
# 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-django-django{18,111}
[testenv]
passenv = CI TRAVIS TRAVIS_*
deps =
django18: Django>=1.8,<1.9
django111: Django>=1.11,<2.0
-rdev-requirements.txt
commands =
make test
whitelist_externals =
make
[testenv:quality]
deps =
-rrequirements.txt
commands =
make quality
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment