summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorBruno Oliveira <nicoddemus@gmail.com>2018-05-18 12:30:08 -0300
committerBruno Oliveira <nicoddemus@gmail.com>2018-05-18 12:30:08 -0300
commit674879976f3f0cebe1798a249ac9a50c850294dd (patch)
treedd29fc83bf62680f63604b4b248caaedaf12aa2a /testing
parent35f53a7353418f63705349aee92b229723646f9c (diff)
parent45faaeca7ae9da3ed4169b6d7a31df06bac4778d (diff)
downloadpytest-674879976f3f0cebe1798a249ac9a50c850294dd.tar.gz
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
Diffstat (limited to 'testing')
-rw-r--r--testing/code/test_excinfo.py2
-rw-r--r--testing/python/fixture.py5
-rw-r--r--testing/python/metafunc.py1
-rw-r--r--testing/test_assertion.py14
-rw-r--r--testing/test_capture.py2
-rw-r--r--testing/test_conftest.py2
-rw-r--r--testing/test_nose.py2
7 files changed, 21 insertions, 7 deletions
diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py
index 6b4adf001..8fd59423f 100644
--- a/testing/code/test_excinfo.py
+++ b/testing/code/test_excinfo.py
@@ -1198,7 +1198,7 @@ def test_cwd_deleted(testdir):
def test_exception_repr_extraction_error_on_recursion():
"""
Ensure we can properly detect a recursion error even
- if some locals raise error on comparision (#2459).
+ if some locals raise error on comparison (#2459).
"""
class numpy_like(object):
diff --git a/testing/python/fixture.py b/testing/python/fixture.py
index 2ba890d05..d9f08a3f0 100644
--- a/testing/python/fixture.py
+++ b/testing/python/fixture.py
@@ -523,6 +523,7 @@ class TestRequestBasic(object):
testdir.makepyfile("""
import sys
import pytest
+ from _pytest.compat import safe_str
import gc
@pytest.fixture(autouse=True)
@@ -539,7 +540,7 @@ class TestRequestBasic(object):
gc.collect()
leaked_types = sum(1 for _ in gc.garbage
- if 'PseudoFixtureDef' in str(_))
+ if 'PseudoFixtureDef' in safe_str(_))
gc.garbage[:] = []
@@ -1552,7 +1553,7 @@ class TestAutouseDiscovery(object):
def test_callables_nocode(self, testdir):
"""
- a imported mock.call would break setup/factory discovery
+ an imported mock.call would break setup/factory discovery
due to it being callable and __code__ not being a code object
"""
testdir.makepyfile("""
diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py
index b96851627..db6dae318 100644
--- a/testing/python/metafunc.py
+++ b/testing/python/metafunc.py
@@ -194,6 +194,7 @@ class TestMetafunc(object):
assert metafunc._calls[3].id == "x1-b"
@hypothesis.given(strategies.text() | strategies.binary())
+ @hypothesis.settings(deadline=400.0) # very close to std deadline and CI boxes are not reliable in CPU power
def test_idval_hypothesis(self, value):
from _pytest.python import _idval
escaped = _idval(value, 'a', 6, None)
diff --git a/testing/test_assertion.py b/testing/test_assertion.py
index 328fe7fa9..51229d3e1 100644
--- a/testing/test_assertion.py
+++ b/testing/test_assertion.py
@@ -473,7 +473,7 @@ class TestAssert_reprcompare(object):
def test_one_repr_empty(self):
"""
the faulty empty string repr did trigger
- a unbound local error in _diff_text
+ an unbound local error in _diff_text
"""
class A(str):
def __repr__(self):
@@ -746,6 +746,18 @@ def test_reprcompare_notin(mock_config):
assert detail == ["'foo' is contained here:", ' aaafoobbb', '? +++']
+def test_reprcompare_whitespaces(mock_config):
+ detail = plugin.pytest_assertrepr_compare(
+ mock_config, '==', '\r\n', '\n')
+ assert detail == [
+ r"'\r\n' == '\n'",
+ r"Strings contain only whitespace, escaping them using repr()",
+ r"- '\r\n'",
+ r"? --",
+ r"+ '\n'",
+ ]
+
+
def test_pytest_assertrepr_compare_integration(testdir):
testdir.makepyfile("""
def test_hello():
diff --git a/testing/test_capture.py b/testing/test_capture.py
index 7fccc055d..bc8ae6534 100644
--- a/testing/test_capture.py
+++ b/testing/test_capture.py
@@ -998,7 +998,7 @@ class TestStdCapture(object):
reason='text output different for bytes on python3')
def test_capturing_readouterr_decode_error_handling(self):
with self.getcapture() as cap:
- # triggered a internal error in pytest
+ # triggered an internal error in pytest
print('\xa6')
out, err = cap.readouterr()
assert out == py.builtin._totext('\ufffd\n', 'unicode-escape')
diff --git a/testing/test_conftest.py b/testing/test_conftest.py
index 6566f752a..93bf8ea8d 100644
--- a/testing/test_conftest.py
+++ b/testing/test_conftest.py
@@ -373,7 +373,7 @@ class TestConftestVisibility(object):
(None, 1, 1),
])
def test_search_conftest_up_to_inifile(testdir, confcutdir, passed, error):
- """Test that conftest files are detected only up to a ini file, unless
+ """Test that conftest files are detected only up to an ini file, unless
an explicit --confcutdir option is given.
"""
root = testdir.tmpdir
diff --git a/testing/test_nose.py b/testing/test_nose.py
index df3e1a94b..1964b06c5 100644
--- a/testing/test_nose.py
+++ b/testing/test_nose.py
@@ -289,7 +289,7 @@ def test_nose_setup_ordering(testdir):
def test_apiwrapper_problem_issue260(testdir):
- # this would end up trying a call a optional teardown on the class
+ # this would end up trying a call an optional teardown on the class
# for plain unittests we dont want nose behaviour
testdir.makepyfile("""
import unittest