summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/tests/test_test.py')
-rw-r--r--setuptools/tests/test_test.py101
1 files changed, 19 insertions, 82 deletions
diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py
index 180562e2..6bce8e20 100644
--- a/setuptools/tests/test_test.py
+++ b/setuptools/tests/test_test.py
@@ -1,4 +1,3 @@
-import mock
from distutils import log
import os
@@ -6,12 +5,12 @@ import pytest
from setuptools.command.test import test
from setuptools.dist import Distribution
-from setuptools.tests import ack_2to3
from .textwrap import DALS
-SETUP_PY = DALS("""
+SETUP_PY = DALS(
+ """
from setuptools import setup
setup(name='foo',
@@ -19,9 +18,11 @@ SETUP_PY = DALS("""
namespace_packages=['name'],
test_suite='name.space.tests.test_suite',
)
- """)
+ """
+)
-NS_INIT = DALS("""
+NS_INIT = DALS(
+ """
# -*- coding: Latin-1 -*-
# Söme Arbiträry Ünicode to test Distribute Issüé 310
try:
@@ -29,17 +30,20 @@ NS_INIT = DALS("""
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
- """)
+ """
+)
-TEST_PY = DALS("""
+TEST_PY = DALS(
+ """
import unittest
class TestTest(unittest.TestCase):
def test_test(self):
- print "Foo" # Should fail under Python 3 unless 2to3 is used
+ print "Foo" # Should fail under Python 3
test_suite = unittest.makeSuite(TestTest)
- """)
+ """
+)
@pytest.fixture
@@ -70,25 +74,6 @@ def quiet_log():
log.set_verbosity(0)
-@pytest.mark.usefixtures('sample_test', 'quiet_log')
-@ack_2to3
-def test_test(capfd):
- params = dict(
- name='foo',
- packages=['name', 'name.space', 'name.space.tests'],
- namespace_packages=['name'],
- test_suite='name.space.tests.test_suite',
- use_2to3=True,
- )
- dist = Distribution(params)
- dist.script_name = 'setup.py'
- cmd = test(dist)
- cmd.ensure_finalized()
- cmd.run()
- out, err = capfd.readouterr()
- assert out == 'Foo\n'
-
-
@pytest.mark.usefixtures('tmpdir_cwd', 'quiet_log')
def test_tests_are_run_once(capfd):
params = dict(
@@ -104,13 +89,16 @@ def test_tests_are_run_once(capfd):
with open('dummy/__init__.py', 'wt'):
pass
with open('dummy/test_dummy.py', 'wt') as f:
- f.write(DALS(
- """
+ f.write(
+ DALS(
+ """
import unittest
class TestTest(unittest.TestCase):
def test_test(self):
print('Foo')
- """))
+ """
+ )
+ )
dist = Distribution(params)
dist.script_name = 'setup.py'
cmd = test(dist)
@@ -118,54 +106,3 @@ def test_tests_are_run_once(capfd):
cmd.run()
out, err = capfd.readouterr()
assert out == 'Foo\n'
-
-
-@pytest.mark.usefixtures('sample_test')
-@ack_2to3
-def test_warns_deprecation(capfd):
- params = dict(
- name='foo',
- packages=['name', 'name.space', 'name.space.tests'],
- namespace_packages=['name'],
- test_suite='name.space.tests.test_suite',
- use_2to3=True
- )
- dist = Distribution(params)
- dist.script_name = 'setup.py'
- cmd = test(dist)
- cmd.ensure_finalized()
- cmd.announce = mock.Mock()
- cmd.run()
- capfd.readouterr()
- msg = (
- "WARNING: Testing via this command is deprecated and will be "
- "removed in a future version. Users looking for a generic test "
- "entry point independent of test runner are encouraged to use "
- "tox."
- )
- cmd.announce.assert_any_call(msg, log.WARN)
-
-
-@pytest.mark.usefixtures('sample_test')
-@ack_2to3
-def test_deprecation_stderr(capfd):
- params = dict(
- name='foo',
- packages=['name', 'name.space', 'name.space.tests'],
- namespace_packages=['name'],
- test_suite='name.space.tests.test_suite',
- use_2to3=True
- )
- dist = Distribution(params)
- dist.script_name = 'setup.py'
- cmd = test(dist)
- cmd.ensure_finalized()
- cmd.run()
- out, err = capfd.readouterr()
- msg = (
- "WARNING: Testing via this command is deprecated and will be "
- "removed in a future version. Users looking for a generic test "
- "entry point independent of test runner are encouraged to use "
- "tox.\n"
- )
- assert msg in err