Daniel Hahler
e30f7094f3
python: collect: ignore exceptions with isinstance
...
Fixes https://github.com/pytest-dev/pytest/issues/4266 .
2018-11-01 22:14:13 +01:00
Anthony Sottile
2368fbb63c
Apply reorder-python-imports to all files
2018-10-25 00:01:29 -07:00
Bruno Oliveira
02ae7d8531
Improve error message when a recursive dependency between fixtures is detected
...
Fix #2909
2018-10-20 09:44:42 -03:00
Bruno Oliveira
9646a1cd7a
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-10-15 12:55:28 -03:00
Bruno Oliveira
4808145846
test_request_garbage is flaky when running with xdist
...
Example failure:
https://travis-ci.org/pytest-dev/pytest/jobs/441305926#L545
2018-10-14 15:17:08 -03:00
Bruno Oliveira
933de16fe4
Merge pull request #3988 from RonnyPfannschmidt/tmpdir-port-pathlib
...
Tmpdir port pathlib
2018-10-12 08:33:47 -03:00
Ronny Pfannschmidt
00716177b4
fix missed Path import
2018-10-11 07:15:09 +02:00
Bruno Oliveira
5436e42990
Use pytest.fail(..., pytrace=False) when treating user errors
...
This prevents an enormous and often useless stack trace from showing
to end users.
Fix #3867
Fix #2293
2018-10-10 19:16:53 -03:00
Bruno Oliveira
9a3836a0cf
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-10-09 19:34:04 -03:00
Anthony Sottile
1caf6d5907
Upgrade pre-commit hooks
2018-10-08 10:10:46 -07:00
Ronny Pfannschmidt
66609665f2
Merge pull request #4076 from nicoddemus/unittest-param-fixture-msg
...
Improve error message when TestCase functions use a parametrized fixture
2018-10-06 07:43:57 +02:00
Bruno Oliveira
212937eb3e
Improve error message when TestCase functions use a parametrized fixture
...
Fix #2535
2018-10-03 19:43:46 -03:00
Bruno Oliveira
70c7273640
Fix request.fixturenames to return fixtures created dynamically
...
Fix #3057
2018-10-03 18:50:14 -03:00
Bruno Oliveira
56d0b5a7e2
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-09-22 18:14:36 -03:00
Bruno Oliveira
41f6ea13ce
Fix 'Package has no len()' error during collection
...
Fix #3749
2018-09-20 17:53:21 -03:00
Bruno Oliveira
27772f67c0
Merge pull request #3987 from nicoddemus/fix-find-scope-3941
...
Fix scope determination with indirect parameters
2018-09-19 20:06:45 -03:00
Bruno Oliveira
86a14d007d
Fix scope determination with indirect parameters
...
Fix #3941
2018-09-14 21:33:59 -03:00
Bruno Oliveira
87ddb2dbd5
Change flaky test_request_garbage to provide more debug information
...
This test fails *very* rarely when running in xdist.
2018-09-14 15:25:45 -03:00
Bruno Oliveira
feb8240410
Use self.Function again during collection
2018-09-13 15:44:02 -03:00
Bruno Oliveira
482bd5efd2
Show deprecation warning for cached_setup
2018-09-13 14:25:46 -03:00
Ronny Pfannschmidt
a0ce9a4441
remove the legacy code about im_func and generalize using fix and compat.getimfunc
2018-09-13 15:38:36 +02:00
Bruno Oliveira
c00d934b21
Merge pull request #3933 from nicoddemus/idval-hypothesis-flaky-3707
...
Use -n auto now that xdist behaves well in Travis and AppVeyor
2018-09-06 15:15:55 -03:00
Bruno Oliveira
5eb85efa14
Use -n auto now that xdist behaves well in Travis and AppVeyor
...
This hopefully fixes the flaky test_idval_hypothesis on AppVeyor
Fix #3707
2018-09-06 09:22:13 -03:00
Bruno Oliveira
adc9ed85bc
Fix test_idval_hypothesis
2018-09-04 18:49:20 -03:00
Bruno Oliveira
5a52acaa92
Make config no longer optional in parametrize id functions
2018-09-04 16:55:52 -03:00
Bruno Oliveira
b42518acd5
Change std_warn to receive a single warning instance, addressed review suggestions
2018-09-04 14:20:42 -03:00
Bruno Oliveira
9965ed84da
Show deprecation warnings by default if no other filters are configured
...
Fix #2908
2018-09-04 11:35:34 -03:00
Bruno Oliveira
78ac7d99f5
Deprecate Config.warn and Node.warn, replaced by standard warnings
2018-09-04 11:35:34 -03:00
Bruno Oliveira
0c8dbdcd92
Fix existing tests now that we are using standard warnings
2018-09-04 11:35:34 -03:00
Bruno Oliveira
29e114b463
Try to fix test in MacOS-X
2018-08-27 19:27:51 -03:00
turturica
8cf0e46bbf
test_package_ordering: Collect *.py, but keep a mix of case for filenames. The test doesn't make sense for Windows, because of its case-insensitivity.
2018-08-24 16:23:50 -07:00
Bruno Oliveira
f0226e9329
Fix test_package_ordering on Windows
2018-08-24 20:15:33 -03:00
turturica
dce8df45d5
Added changelog items.
2018-08-24 15:51:42 -07:00
turturica
e3df1031ca
Add encoding: utf8 for python 2.7
2018-08-24 12:26:18 -07:00
turturica
459b040d21
Fix dedent after merge.
2018-08-24 11:54:04 -07:00
turturica
3396225f74
Merge branch 'master' of github.com:pytest-dev/pytest into fix-3854
2018-08-24 11:47:24 -07:00
turturica
5f8b50c094
Address #3796 and add a test for it.
2018-08-23 22:48:44 -07:00
Anthony Sottile
85482d575e
Replace Source with dedent where possible
2018-08-23 09:06:17 -07:00
Anthony Sottile
0fc4a806e5
py.builtins._totext -> string literals or six.text_type
2018-08-22 23:00:04 -07:00
turturica
4d3c1ab4f0
Fixes #3854
2018-08-22 21:42:59 -07:00
turturica
e92893ed24
Add test for packages mixed with modules.
2018-08-10 17:29:30 -07:00
Bruno Oliveira
dcafb8c48c
Add example for package recursion bug
2018-08-03 15:40:33 -03:00
Ronny Pfannschmidt
ca0476953e
Merge pull request #3751 from nicoddemus/collect-file-bug
...
Workaround for #3742
2018-08-02 07:35:46 +02:00
Ronny Pfannschmidt
33769d0328
Merge pull request #3754 from nicoddemus/fix-function-call-warning
...
Refactor direct fixture call warning to avoid incompatibility with plugins
2018-08-02 07:17:15 +02:00
Bruno Oliveira
c6b11b9f62
Refactor direct fixture call warning to avoid incompatibility with plugins
...
This refactors the code so we have the real function object right during
collection. This avoids having to unwrap it later and lose attached information
such as "async" functions.
Fix #3747
2018-08-01 16:38:43 -03:00
Bruno Oliveira
43664d7841
Use ids for parametrized values in test_expected_value_type_error
2018-08-01 07:34:08 -03:00
Bruno Oliveira
6e32a1f73d
Use parametrize in repr test for nd arrays
2018-08-01 07:04:25 -03:00
Bruno Oliveira
e1ad1a14af
Add example script and failure for #3742
2018-07-31 17:50:55 -03:00
Kale Kundert
032db159c9
Let black reformat the code...
2018-07-31 11:23:23 -07:00
Kale Kundert
cd2085ee71
approx(): Detect type errors earlier.
2018-07-31 00:26:35 -07:00
Kale Kundert
7d8688d54b
Reflect dimension in approx repr for numpy arrays.
2018-07-30 23:23:17 -07:00
Bruno Oliveira
eada0b1fd7
Merge remote-tracking branch 'upstream/master' into release-3.7.0
2018-07-30 20:12:30 +00:00
abrammer
535fd1f311
may as well include inf test while we're at it
2018-07-29 23:12:04 -04:00
abrammer
330640eb96
update tests to check tolerance args and expecing nan in numpy arrays
2018-07-29 22:47:38 -04:00
Bruno Oliveira
6e57d123bb
Mark test_idval_hypothesis as flaky on Windows ( #3707 )
2018-07-26 19:58:42 -03:00
Bruno Oliveira
011f88f7e7
Deprecate calling fixture functions directly
...
This will now issue a RemovedInPytest4Warning when the user calls
a fixture function directly, instead of requesting it from test
functions as is expected
Fix #3661
2018-07-26 19:58:42 -03:00
abrammer
f0db64ac2e
drop the duplicate approx call
...
update test to include both np.array(actual) and np.array(expected)
2018-07-24 21:18:44 -04:00
abrammer
514ca6f4ad
add test wrt #3695 checking numpy array tolerance args
2018-07-23 23:40:06 -04:00
Bruno Oliveira
ac9ceaacd8
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-07-15 11:54:14 -03:00
Bruno Oliveira
f6ceedd15b
Merge pull request #3636 from RonnyPfannschmidt/fixturetest-examples
...
[RFC] Fixturetest examples - move test contents to use example scripts for contents
2018-07-11 23:29:33 -03:00
Anthony Sottile
4ae93a7a07
Remove obsolete __future__ imports
2018-07-08 08:37:02 -07:00
Bruno Oliveira
3c19370cec
Merge remote-tracking branch 'upstream/features' into jonozzz/features
2018-07-05 18:15:17 -03:00
Ronny Pfannschmidt
0fd86ec8a8
move some fill fixture acceptance tests contents to the examples script folder
2018-06-29 10:58:33 +02:00
Ronny Pfannschmidt
4ae7e9788c
fix quotes in scope order test
2018-06-29 07:13:18 +02:00
Ronny Pfannschmidt
5582ad0445
remove use of formatting in test_func_closure_module_auto
...
this makes it apparent that pytester should supply some kind of variable support
2018-06-29 07:07:03 +02:00
Ronny Pfannschmidt
982b614010
remove format calls for most fixture tests
2018-06-29 07:07:03 +02:00
Ronny Pfannschmidt
7845ab4bc3
remove test file formatting from TestContextManagerFixtureFuncs
2018-06-29 07:07:03 +02:00
Serhii Mozghovyi
1dc5e97ac2
Make test parametrization override indirect fixtures
2018-06-28 14:32:29 +03:00
Anthony Sottile
cbaa7dd56a
Upgrade pre-commit hooks except pyupgrade
2018-06-26 06:35:27 -07:00
Marcelo Duarte Trevisani
0030ceb11c
Bug fix #3593 - approx method in a single element of numpy array
...
If the user pass as a expected value a numpy array created like
numpy.array(5); it will creates an array with one element without shape,
when used with approx it will raise an error
'TypeError: iteration over a 0-d array'
2018-06-25 22:55:16 +02:00
Ronny Pfannschmidt
321f66f711
mark test_wrapped_getfuncargnames_patching as xfail
2018-06-12 22:25:05 +02:00
Bruno Oliveira
5ea647a245
Attempt to fix flaky test_request_garbage on Windows
...
Fix #3564
2018-06-10 19:18:44 -03:00
Ronny Pfannschmidt
3e08c4ee64
sort out flake8 issues and unicode name usage
2018-05-23 18:12:04 +02:00
Ronny Pfannschmidt
703e4b11ba
run black
2018-05-23 16:48:46 +02:00
Ronny Pfannschmidt
9aacb4635e
run pyupgrade
2018-05-23 16:45:09 +02:00
Bruno Oliveira
674879976f
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-05-18 12:30:08 -03:00
Bruno Oliveira
94e62dfc50
Increase hypothesis deadline
...
The value is pretty close to the new default that will come out in
future hypothesis versions, which is generating a deprecation error
on CI.
Using a loose deadline because CI boxes are not reliable in how much
CPU power they have available
2018-05-16 07:34:53 -03:00
Ville Skyttä
aa51fcb2b6
Spelling and grammar fixes
2018-05-13 12:06:09 +02:00
Bruno Oliveira
fa76a5c8fe
Attempt to fix flaky test on Python 2
...
This test sometimes fails on AppVeyor with:
```
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.0 = <listiterator object at 0x0549DC50>
leaked_types = sum(1 for _ in gc.garbage
> if 'PseudoFixtureDef' in str(_))
E UnicodeEncodeError: 'ascii' codec can't encode character u'\u263a' in position 23: ordinal not in range(128)
test_request_garbage.py:19: UnicodeEncodeError
====================== 1 passed, 1 error in 1.39 seconds ======================
```
Use our internal "safe_repr" function to handle Encode errors: who knows
what objects are in garbage after all.
2018-05-04 17:56:51 -03:00
turturica
05b5b64379
Merge remote-tracking branch 'upstream/features' into features
2018-04-25 21:20:39 -07:00
Bruno Oliveira
63368e07ea
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-04-24 21:26:45 -03:00
turturica
d483b401ee
Merge remote-tracking branch 'upstream/features' into features
2018-04-24 13:45:10 -07:00
turturica
acacf75f49
Added another package-scoped fixture test.
...
Changed existing complex tests to use package fixtures.
2018-04-24 13:32:58 -07:00
Bruno Oliveira
132fb61eba
Merge remote-tracking branch 'upstream/features' into ApaDoctor/disable-repeated-fixture
2018-04-23 22:24:53 -03:00
Bruno Oliveira
03850cf962
Add test for applying fixture twice
...
Fix #2334
2018-04-23 22:17:46 -03:00
turturica
7d923c389e
Merge remote-tracking branch 'upstream/features' into features
2018-04-18 00:11:03 -07:00
turturica
c02e8d8b0d
Fix test collection when tests are passed as IDs at the command line. Note this is still broken due to #3358 .
2018-04-16 11:44:05 -07:00
Brian Maissy
857098fe0f
added indicative error when parametrizing an argument with a default value
2018-04-15 20:52:57 +03:00
turturica
2b1410895e
Add package scoped fixtures #2283
2018-04-11 15:39:42 -07:00
Bruno Oliveira
10a7160549
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-04-11 18:07:47 -03:00
Tim Strazny
ec2d8223cf
Fix issue #3372
2018-04-06 14:16:12 +02:00
Ronny Pfannschmidt
99015bfc86
fix most of metafunc tests by mocking
2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
180ae09202
deprecate markinfo and fix up most marker scoping access while completely breaking metafunc testing
2018-03-29 17:52:01 +02:00
Jeffrey Rackauckas
34afded06d
Update pytest.raises to raise a TypeError when an invalid keyword argument is passed.
2018-03-27 19:57:15 -07:00
Bruno Oliveira
59e7fd478e
Sort fixtures by scope when determining fixture closure
...
Fix #2405
2018-03-20 20:10:53 -03:00
Bruno Oliveira
9e24b09a9f
Use re_match_lines in test_class_ordering
...
"[1-a]" works fine using fnmatch_lines, but "[a-1]" breaks horribly
inside `re`.
2018-03-20 20:10:52 -03:00
Tadeu Manoel
161d4e5fe4
Add support for pytest.approx comparisons between scalar and array (inverted order)
2018-03-14 16:29:04 -03:00
Tadeu Manoel
c34dde7a3f
Add support for pytest.approx comparisons between array and scalar
2018-03-14 15:47:21 -03:00
Bruno Oliveira
bedceaacc4
Merge pull request #3249 from a-feld/request-fixture-reference-cycle
...
Fix PseudoFixtureDef reference cycle.
2018-02-22 19:23:56 -03:00
Allan Feldman
aa53e37fa2
Add a test to expose leaked PseudoFixtureDef types.
2018-02-21 22:42:44 -08:00
mike
6e14585ca2
Fix approx default tolerances for Decimal
2018-02-21 23:08:23 +01:00
Bruno Oliveira
b486e1294b
Merge pull request #3222 from The-Compiler/match-msg
...
Remove "matching '...'" part from the pytest.raises message
2018-02-17 21:18:05 -02:00
Florian Bruhin
3cbf0c8ec0
Raise unexpected exceptions with pytest.raises() using match=
2018-02-15 12:11:56 +01:00
Marcin Bachry
b6166dccb4
Fix mock patchings detection when both mock and unittest.mock are present
2018-02-12 20:29:37 +01:00
Aaron
4458e65fe7
Fix ordering of tests to minimize fixture creating
2018-02-01 13:07:45 -08:00
Bruno Oliveira
aff463a3c4
Merge remote-tracking branch 'upstream/master' into features
2018-01-27 12:28:43 -02:00
Ronny Pfannschmidt
7f83605c81
fix empty parameterset tests by mocking a config object
2018-01-26 11:10:00 +01:00
Bruno Oliveira
af37778b0d
All classes now subclass object for better py3 compatibility
...
Fix #2147
2018-01-24 18:23:42 -02:00
Anthony Sottile
bd1d17e8de
Replace py.std with stdlib imports
2018-01-09 12:44:10 -08:00
Ronny Pfannschmidt
afc607cfd8
move node base classes from main to nodes
2017-12-18 11:08:20 +01:00
ST John
652936f47f
make linter happier
2017-11-30 10:29:05 +00:00
ST John
e66473853c
add test
2017-11-30 10:19:29 +00:00
Bruno Oliveira
dab889304e
Implement progress percentage reporting while running tests
...
Fix #2657
2017-11-21 21:01:41 -02:00
Bruno Oliveira
f074fd9ac6
Merge remote-tracking branch 'upstream/features' into malinoff/fix-2124
2017-11-12 11:16:08 -02:00
Bruno Oliveira
6550b9911b
pytest_fixture_post_finalizer now receives a request argument
2017-11-12 11:14:55 -02:00
Bruno Oliveira
258031afe5
Merge remote-tracking branch 'upstream/master' into malinoff/fix-2124
2017-11-12 10:34:47 -02:00
Bruno Oliveira
983a09a2d4
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2017-11-10 18:33:02 -02:00
Bruno Oliveira
03829fde8a
Fix linting E741: ambiguous variable name
2017-11-04 13:59:10 -02:00
Ronny Pfannschmidt
d1aa553f73
add mocked integrationtest for the deprecationwarning of makeitem
2017-10-30 19:49:14 +01:00
Bruno Oliveira
f7387e45ea
Fix linting
2017-10-19 21:50:15 -02:00
Ceridwen
3da28067f3
Replace introspection in compat.getfuncargnames() with inspect/funcsigs.signature
2017-10-19 16:01:26 -07:00
hugovk
ef732fc51d
Remove code for unsupported Python versions
2017-10-10 08:54:56 +03:00
Bruno Oliveira
e7a4d3d8cf
Merge remote-tracking branch 'upstream/master' into features
2017-10-04 17:28:34 -03:00
Oliver Bestwalter
2802135741
fix 'DoctestItem' object has no attribute '_fixtureinfo'
...
* doxtests don't seem to have this attribute, so nothing will be written in that case.
* tried to be a good boy scout and tidied up surrounding code a bit (comments, shadowed/unused names, removed random new lines, naming things)
2017-09-19 12:41:12 +02:00
Bruno Oliveira
afe7966683
Fix call to outcome.get_result now that outcome.result is deprecated
2017-09-18 21:36:54 -03:00
Bruno Oliveira
9273e11f21
Merge branch 'master' into features
2017-09-07 13:59:10 -03:00
Bruno Oliveira
3dc0da9339
Remove __multicall__ warning and usages in testing
...
pluggy>=0.5 already warns about those
2017-09-01 18:53:06 -03:00
Bruno Oliveira
a993add783
Allow tests declared as @staticmethod to use fixtures
...
Fix #2699
2017-08-17 20:44:19 -03:00
Ronny Pfannschmidt
eb462582af
fix #2675 - store marks correctly in callspecs
2017-08-10 19:46:36 +02:00
Bruno Oliveira
763c580a2a
Merge pull request #2576 from maiksensi/feat/raise-not-implemented-for-lt-gt-in-approx
...
#2003 Change behavior of `approx.py` to only support `__eq__` comparison
2017-07-30 17:48:33 -03:00
Lawrence Mitchell
a546a612bd
Fix nondeterminism in fixture collection order
...
fixtures.reorder_items is non-deterministic because it reorders based
on iteration over an (unordered) set. Change the code to use an
OrderedDict instead so that we get deterministic behaviour, fixes #920 .
2017-07-26 14:41:10 +01:00
Lawrence Mitchell
b39f957b88
Add test of issue #920
2017-07-26 14:38:38 +01:00
Bruno Oliveira
80f4699572
approx raises TypeError in Python 2 for comparison operators other than != and ==
2017-07-25 20:07:10 -03:00
Bruno Oliveira
0726d9a09f
Turn warnings into errors in pytest's own test suite
...
Fix #2588
2017-07-22 21:44:18 -03:00
Bruno Oliveira
d44565f385
Merge remote-tracking branch 'upstream/master' into fix-flake8-errors
2017-07-19 17:57:30 -03:00
Bruno Oliveira
24da938321
Fix additional flake8 errors
2017-07-19 17:42:21 -03:00
Bruno Oliveira
c92760dca8
Merge branch 'fix-flake8-issues'
2017-07-19 17:03:36 -03:00
Bruno Oliveira
7b1870a94e
Fix flake8 in features branch
2017-07-17 21:16:14 -03:00
Bruno Oliveira
4fd92ef9ba
Merge branch 'fix-flake8-issues' into features
2017-07-17 21:05:39 -03:00
Andras Tim
5ae59279f4
Fixed E704 flake8 errors
...
multiple statements on one line (def)
2017-07-17 01:44:23 +02:00
Andras Tim
85141a419f
Fixed E701 flake8 errors
...
multiple statements on one line (colon)
2017-07-17 01:44:23 +02:00
Andras Tim
7d2ceb7872
Fixed E501 flake8 errors
...
line too long (> 120 characters)
2017-07-17 01:44:23 +02:00
Andras Tim
7248b759e8
Fixed E303 flake8 errors
...
too many blank lines (3)
2017-07-17 01:44:23 +02:00
Andras Tim
b840622819
Fixed E302 flake8 errors
...
expected 2 blank lines, found 0
2017-07-17 01:44:23 +02:00
Andras Tim
17a21d540b
Fixed E301 flake8 errors
...
expected 1 blank line, found 0
2017-07-17 01:44:23 +02:00
Andras Tim
195a816522
Fixed E265 flake8 errors
...
block comment should start with ‘# ‘
2017-07-17 01:44:22 +02:00
Andras Tim
8f3eb6dfc7
Fixed E261 flake8 errors
...
at least two spaces before inline comment
2017-07-17 01:44:22 +02:00
Andras Tim
617e510b6e
Fixed E231 flake8 errors
...
missing whitespace after ‘,’, ‘;’, or ‘:’
2017-07-17 01:44:22 +02:00
Andras Tim
2e8caefcab
Fixed E225 flake8 errors
...
missing whitespace around operator
2017-07-17 01:44:22 +02:00
Andras Tim
1ff54ba205
Fixed E201 flake8 errors
...
whitespace after ‘(‘
2017-07-17 01:28:17 +02:00
Andras Tim
df54bf0db5
Fixed E131 flake8 errors
...
continuation line unaligned for hanging indent
2017-07-17 01:28:16 +02:00
Andras Tim
cf97159009
Fixed E128 flake8 errors
...
continuation line under-indented for visual indent
2017-07-17 01:28:16 +02:00
Andras Tim
57438f3efe
Fixed E127 flake8 errors
...
continuation line over-indented for visual indent
2017-07-17 01:28:16 +02:00
Andras Tim
e855a79dd4
Fixed E126 flake8 errors
...
continuation line over-indented for hanging indent
2017-07-17 01:28:16 +02:00
Andras Tim
051d76a63f
Fixed E124 flake8 errors
...
closing bracket does not match visual indentation
2017-07-17 01:28:16 +02:00
Andras Tim
4b20b9d8d9
Fixed E123 flake8 errors
...
closing bracket does not match indentation of opening bracket’s line
2017-07-17 01:28:16 +02:00
Andras Tim
425665cf25
Fixed E122 flake8 errors
...
continuation line missing indentation or outdented
2017-07-17 01:28:16 +02:00
Andras Tim
0be97624b7
Fixed E121 flake8 errors
...
continuation line under-indented for hanging indent
2017-07-17 01:28:16 +02:00
Andras Tim
6af2abdb53
Fixed flake8 warnings
...
W191 indentation contains tabs
W292 no newline at end of file
W293 blank line contains whitespace
W391 blank line at end of file
2017-07-17 01:28:16 +02:00
Martin Altmayer
e5169a026a
#2574 : --fixtures, --fixtures-per-test keep indentation of docstring
2017-07-15 13:33:11 +02:00
Ronny Pfannschmidt
ef62b86335
Merge pull request #2492 from kalekundert/features
...
Add support for numpy arrays (and dicts) to approx.
2017-07-06 11:46:51 +02:00
Kale Kundert
8524a57075
Add "approx" to all the repr-strings.
2017-07-03 22:44:37 -07:00
Nathaniel Waisbrot
9b9fede5be
allow staticmethods to be detected as test functions
...
Allow a class method decorated `@staticmethod` to be collected as a test
function (if it meets the usual criteria).
This feature will not work in Python 2.6 -- static methods will still be
ignored there.
2017-06-29 07:44:36 -04:00
Kale Kundert
50769557e8
Skip the numpy doctests.
...
They seem like more trouble that they're worth.
2017-06-15 14:53:27 -07:00
Kale Kundert
8badb47db6
Implement suggestions from code review.
...
- Avoid importing numpy unless necessary.
- Mention numpy arrays and dictionaries in the docs.
- Add numpy to the list of tox dependencies.
- Don't unnecessarily copy arrays or allocate empty space for them.
- Use code from compat.py rather than writing py2/3 versions of things
myself.
- Avoid reimplementing __repr__ for built-in types.
- Add an option to consider NaN == NaN, because sometimes people use NaN
to mean "missing data".
2017-06-15 09:19:10 -07:00
Bruno Oliveira
4e4ebbef5a
Improve test to ensure the expected function is re-raised
2017-06-13 20:16:48 -03:00
Ryan Fitzpatrick
5a856b6e29
handle and reraise subrequest finalizer exceptions
2017-06-12 21:26:42 -04:00
Kale Kundert
9f3122fec6
Add support for numpy arrays (and dicts) to approx.
...
This fixes #1994 . It turned out to require a lot of refactoring because
subclassing numpy.ndarray was necessary to coerce python into calling
the right `__eq__` operator.
2017-06-11 19:27:41 -07:00
Bruno Oliveira
f3b359f5b8
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
...
# Conflicts:
# _pytest/capture.py
# _pytest/compat.py
# _pytest/python.py
# testing/python/collect.py
# testing/test_mark.py
2017-05-03 19:04:53 -03:00
Kodi Arfer
dcefb287fc
Try not to assume a module's file extension is .py
2017-04-19 12:26:56 -07:00
Bruno Oliveira
58ac4faf0c
Fix exception formatting while importing test modules
...
Fix #2336
2017-03-29 14:43:13 -03:00
Bruno Oliveira
fa56114115
Clean up warnings generated by pytest's own suite
2017-03-20 22:13:17 -03:00
Bruno Oliveira
9f85584656
Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings
2017-03-20 19:59:05 -03:00
Ronny Pfannschmidt
e368fb4b29
implement pytest.param
...
this allows a clear addition of parameterization parameters that carry along marks
instead of nesting multiple mark objects and destroying the possibility of creating
function valued parameters,
it just folders everything together into one object carrfying parameters, and the marks.
2017-03-17 16:53:43 +01:00
Bruno Oliveira
e5021dc9dc
Replace py.builtin.print_() calls by builtin print() function
2017-03-16 22:46:51 -03:00
Bruno Oliveira
78194093af
Improve warning representation in terminal plugin and fix tests
2017-03-16 21:57:32 -03:00
Bruno Oliveira
1e0cf5ce4d
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
...
# Conflicts:
# AUTHORS
# CHANGELOG.rst
# _pytest/pytester.py
2017-03-10 15:54:05 -03:00
Michal Wajszczuk
fb0b90646e
New-style classes implemented for python 2.7 - #2147
2017-02-16 20:28:17 +01:00
Ran Benita
3a0a0c2df9
Ignore errors raised from descriptors when collecting fixtures
...
Descriptors (e.g. properties) such as in the added test case are
triggered during collection, executing arbitrary code which can raise.
Previously, such exceptions were propagated and failed the collection.
Now these exceptions are caught and the corresponding attributes are
silently ignored.
A better solution would be to completely skip access to all custom
descriptors, such that the offending code doesn't even trigger. However
I think this requires manually going through the instance and all of its
MRO for each and every attribute checking if it might be a proper
fixture before accessing it. So I took the easy route here.
In other words, putting something like this in your test class is still
a bad idea...:
@property
def innocent(self):
os.system('rm -rf /')
Fixes #2234 .
2017-02-07 14:27:34 +02:00
Bruno Oliveira
abbff681ba
Fix '{0}' format for py26
2017-02-02 18:01:44 -02:00
Thomas Kriechbaumer
43662ce789
allow error message matching in pytest.raises
2017-02-02 19:52:33 +01:00
Ravi Chandra
0e58c3fa80
updates for PR review #2198
2017-01-21 16:47:49 +13:00
Ravi Chandra
c848d0a771
Pass parameter name to `make_parametrize_id` hook function
2017-01-21 16:46:45 +13:00
Rafael Bertoldi
a9193a1531
No longer silently ignore errors in parametrize callable ids
2017-01-02 17:26:17 -02:00
Bruno Oliveira
402fbe503a
Merge branch 'master' into merge-master-into-features
2016-12-27 23:31:26 -02:00
Dmitry Malinovsky
522d59e844
Use session.config.hook instead of ihook. Fixes #2124
2016-12-10 16:45:40 +06:00
Bruno Oliveira
57c4489916
Use a simple ``+-`` ASCII string in the string representation of pytest.approx In Python 2
...
Fix #2111
2016-12-02 20:01:53 -02:00
Bruno Oliveira
b30a6d22c5
Merge branch 'master' into merge-master-into-features
2016-11-27 17:30:40 -02:00
Bruno Oliveira
33c0b06fdf
Fix error in approx's repr with complex numbers
...
Fix #2082
2016-11-24 15:33:12 -02:00
Bruno Oliveira
5ce551e469
Merge pull request #2075 from pytest-dev/master
...
Merge master into features after fixing flake8 errors
2016-11-22 14:10:31 -02:00
Bruno Oliveira
1eb5a690d4
Fix flake8 E305 and E306 errors
...
These errors started to appear with flake8-3.1.1, while they don't appear with
version 3.1.0 (weird).
2016-11-20 18:59:15 -02:00
Bruno Oliveira
efc54b2e56
Merge branch 'master' into merge-master-features
2016-11-11 18:56:53 -02:00
Bruno Oliveira
1130b9f742
Fix the stubborn test about cyclic references left by pytest.raises
...
In Python 2, a context manager's __exit__() leaves sys.exc_info with the exception values even when it was supposed
to suppress the exception, so we explicitly call sys.exc_clear() which removes the traceback and allow the object
to be released.
Also updated the test to not depend on the immediate destruction of the object but instead to ensure it is not being
tracked as a cyclic reference.
Fix #1965
2016-11-08 22:20:27 -02:00
Michael Seifert
552c7d4286
added test (thanks @nicoddemus) and added links in Changelog
2016-11-08 22:13:02 -02:00
Bruno Oliveira
9d00615bbf
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2016-10-20 21:51:42 -02:00
Bruno Oliveira
a1d446b8e8
Display traceback from Import errors using pytest's short representation
...
Also omit pytest's own modules and internal libraries (py and pluggy) in low verbosity
Fix #1976
2016-10-03 21:46:44 -03:00
Bruno Oliveira
7d66e4eae1
Display full traceback from Import errors when collecting test modules
...
Fix #1976
2016-10-03 20:47:44 -03:00
Bruno Oliveira
654af0ba25
Merge remote-tracking branch 'upstream/master' into features
2016-09-26 19:32:53 -03:00
Tyler Goodlet
6db2f315fa
Explain a bad scope value to the user
2016-09-21 16:40:58 -04:00
Ronny Pfannschmidt
1c9bd9278e
Merge pull request #1913 from flub/builtin-assertion
...
Remove BuiltinAssertionError
2016-09-05 16:53:13 +02:00
Floris Bruynooghe
28b1896e9a
Remove BuiltinAssertionError
...
We used to have this when we where patching the real Python
AssertionError for use with reinterpret, but reinterpret is now
gone so we no longer need this as it is not used by rewrite.
2016-09-05 15:29:09 +02:00
Bruno Oliveira
1e10de574d
The "ids" argument to "parametrize" again accepts unicode strings in Python 2
...
Fixes #1905
2016-09-02 18:38:15 -03:00
Bruno Oliveira
972a5fb5d5
Improve error message when passing non-string ids to pytest.mark.parametrize
...
Fix #1857
2016-08-23 23:31:45 -03:00
Bruno Oliveira
df200297e2
Fix internal error when parametrizing using and empty list of ids()
...
Fix #1849
2016-08-23 18:18:46 -03:00
Bruno Oliveira
53a0e2b118
Fix code which guesses parametrized scope based on arguments
...
Fix #1832
2016-08-22 21:05:41 -03:00
Bruno Oliveira
463e6572c5
Merge branch 'master' into merge-master-into-features
...
Preparing for 3.0
2016-08-17 22:39:23 -03:00
Raphael Pierzina
dfc659f781
Fix sys.version_info expression in xfail marker
2016-08-17 23:32:56 +01:00
Raphael Pierzina
0173952961
Fix py3 xfail expression evaluation and parametrize strict
2016-08-17 23:15:14 +01:00
Florian Bruhin
c8ab79402c
Merge pull request #1811 from nicoddemus/revert-invocation-fixtures
...
Revert invocation-fixtures code
2016-08-17 20:32:54 +02:00
Bruno Oliveira
707b6b5e3f
Revert all invocation-fixtures code
...
Due to a serious regression found in #1794 , it was decided to pull off
invocation features from 3.0 so it can be (hopefully) re-introduced
in 3.1
2016-08-17 08:12:55 -03:00
Daniel Hahler
c163cc7937
Improve display of continuation lines with multiline errors
...
Fixes https://github.com/pytest-dev/pytest/issues/717 .
Follow-up to https://github.com/pytest-dev/pytest/pull/1762 .
2016-08-14 22:34:31 +02:00
Bruno Oliveira
1a79137d04
Add originalname attribute to Function
...
Related to #1790
2016-08-03 22:56:12 -03:00
Bruno Oliveira
277b6d3974
Sort fixture names when a fixture lookup error occurs
2016-08-02 19:45:31 -03:00
Bruno Oliveira
553dc2600f
Strip invocation-scope suffix when displaying fixture lookup error
2016-08-01 20:34:56 -03:00
Bruno Oliveira
44ecf2ab2f
invocation-scoped fixtures show up once with --fixtures
2016-08-01 18:48:29 -03:00
Floris Bruynooghe
510a6083ba
Merge pull request #1758 from nicoddemus/deprecated-module
...
Add deprecation module to centralize deprecation messages and bits of…
2016-07-28 22:36:55 +01:00
Bruno Oliveira
c2864aba3d
Merge branch 'master' into merge-master
...
# Conflicts:
# AUTHORS
# CHANGELOG.rst
# _pytest/monkeypatch.py
# _pytest/python.py
2016-07-25 19:06:29 -03:00
Bruno Oliveira
6c8b0a28e1
Add deprecation module to centralize deprecation messages and bits of code
2016-07-25 18:14:39 -03:00
Dmitry Dygalo
d72afe7e08
Fixed scope override inside metafunc.parametrize. Fixes #634
2016-07-25 12:42:50 +02:00
Roberto Polli
ab6aef1d1f
feature: default behavior now is to ignore duplicate paths specified from the command line. Use --keep-duplicates to retain duplicate paths.
2016-07-25 12:41:58 +02:00
Dmitry Dygalo
f7ad173fee
Fixed collection of classes with custom ``__new__`` method
2016-07-25 11:33:37 +02:00
Bruno Oliveira
a24146dd3c
Merge pull request #1757 from tramwaj29/improved-message-when-not-using-parametrized-variable
...
Improved message when not using parametrized variable
2016-07-24 13:02:03 -03:00
JJ
d000f2536a
added a test for when the indirect is just a string
2016-07-24 10:47:06 +02:00
Daniel Hahler
5c5d7e05f7
Followup to #1718 : style/formatting
2016-07-24 00:21:42 +02:00
Diego Russo
1704b7d265
Test case for overriding autouse fixtures
...
Test case for overriding autouse fixture with a parametrized fixture.
The test covers the problem explained in the issue 1601
Adding Diego Russo to AUTHORS
2016-07-23 16:53:39 +02:00
JJ
f26fa5a441
changed error message for unused parametrize name
2016-07-23 16:49:20 +02:00
Bruno Oliveira
4f2bf965cb
Merge remote-tracking branch 'upstream/features' into invocation-scoped-fixtures
2016-07-20 21:16:27 -03:00
Bruno Oliveira
6aea164b6d
Add more tests for invocation scoped fixtures
2016-07-20 21:02:36 -03:00
RedBeardCode
22bb43413f
Added confcutdir in testing/test_conftest.py::test_conftest_import_order and
...
testing/python/fixture.py::TestAutouseManagement::()::
test_class_function_parametrization_finalization to avoid problems with
abandoned conftest.py files in /tmp dir.
Fixes #1536
2016-07-14 18:15:38 +02:00
Bruno Oliveira
458ecae1df
Replace all usages of "pytest_funcarg__" for @pytest.fixture
2016-07-11 22:21:52 -03:00
Bruno Oliveira
0ca06962e9
Improve docs
2016-07-11 20:33:16 -03:00
Bruno Oliveira
fb4da00a32
Merge remote-tracking branch 'upstream/features' into invocation-scoped-fixtures
2016-07-11 20:09:13 -03:00
Bruno Oliveira
8ed055efd8
Add acceptance test for invocation-scoped fixtures
2016-07-09 22:52:07 -03:00
Ronny Pfannschmidt
8c49561470
split most fixture related code into own plugin
2016-07-09 20:36:00 +02:00
Ronny Pfannschmidt
b9a91dc112
merge from master to features
2016-07-06 11:51:48 +02:00
Steffen Allner
b650c3c118
Implement --setup-show cli flag
...
to also be able to see fixture setup with normal test execution.
2016-07-03 22:30:51 +02:00
Danielle Jenkins
9877bf47e3
Improve commenting for setupplan unittest.
2016-06-25 12:21:31 +02:00
Tom Viner
df9918eda3
issue1625, name getfuncargvalue to getfixturevalue
2016-06-24 10:08:19 +02:00
Vasily Kuznetsov
c6af737d4e
Fix fixture parameter display when ids is a function
2016-06-23 10:54:22 +02:00
Vasily Kuznetsov
1a5e530b98
Fix capturing with --setup-only/--setup-plan
2016-06-23 10:23:04 +02:00
Steffen Allner
dd97a2e7c8
Merge from upstream
2016-06-22 17:51:48 +02:00
Vasily Kuznetsov
f7d50dfa91
Add a test for handling of dynamic requests for fixtures from other fixtures
2016-06-22 17:24:55 +02:00
Vasily Kuznetsov
61992b4e22
Implement --setup-plan option
2016-06-22 16:45:36 +02:00
Ronny Pfannschmidt
18ef7de96b
merge from master again
2016-06-22 16:03:52 +02:00
Ronny Pfannschmidt
083f64100d
merge master into features
2016-06-22 14:39:33 +02:00
Vasily Kuznetsov
1a75139f72
Fix the tests
2016-06-22 13:25:46 +02:00
Steffen Allner
7d19f83982
Add test for setuponly option
2016-06-22 12:00:45 +02:00
Oliver Bestwalter
7d87a1b127
Add test for failing assertion
...
Should contain function name that caused the failure (see pull request #1631 ).
2016-06-22 11:23:50 +02:00
Tom Viner
5854a71ece
Issue 460: getfuncargvalue fixture w. params err
2016-06-21 11:29:21 +02:00
Florian Bruhin
54872e94b4
Fix test name typo
2016-06-20 18:44:34 +02:00