Bruno Oliveira
463e6572c5
Merge branch 'master' into merge-master-into-features
...
Preparing for 3.0
2016-08-17 22:39:23 -03: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
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
d911bfcb8a
Merge branch 'issue634-scopes' of https://github.com/Stranger6667/pytest
...
# Conflicts:
# CHANGELOG.rst
2016-07-25 18:26:50 -03:00
Bruno Oliveira
8f29ce26e9
Merge branch 'mark_missing_fixture_error' of https://github.com/eolo999/pytest
2016-07-25 18:20:17 -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
Dmitry Dygalo
f7ad173fee
Fixed collection of classes with custom ``__new__`` method
2016-07-25 11:33:37 +02:00
JJ
d000f2536a
added a test for when the indirect is just a string
2016-07-24 10:47:06 +02:00
Edoardo Batini
6799a47c78
Start FixtureLookupErrorRepr with an 'E'
2016-07-23 23:43:34 +02:00
JJ
f26fa5a441
changed error message for unused parametrize name
2016-07-23 16:49:20 +02:00
Javi Romero
7e37497d5a
Uppercase first word in docstrings. Change to an imperative form. Add name to authors.
2016-07-22 12:39:06 +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
ff8fb4950e
setup_* and teardown_* functions argument now optional
...
setup_module, setup_function and setup_method
extra argument are now optional and may be omitted.
Fix #1728
2016-07-14 23:41:40 -03:00
Bruno Oliveira
5506dc700c
Deprecate yield tests
...
Closes #16
Closes #1324
2016-07-11 22:21:49 -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
775100881a
Implement invocation-scoped fixtures
2016-07-09 22:52:05 -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
holger krekel
13a188fe37
Merge pull request #1647 from sallner/features
...
Add new options to report fixture setup and teardown
2016-06-25 16:38:37 +02:00
Danielle Jenkins
032ce8baf6
Switch setuponly and setupplan options to a hook-based implementation.
2016-06-25 12:19:46 +02:00
Omar Kohl
d81f23009b
Raise CollectError if pytest.skip() is called during collection
...
pytest.skip() must not be used at module level because it can easily be
misunderstood and used as a decorator instead of pytest.mark.skip, causing the
whole module to be skipped instead of just the test being decorated.
This is unexpected for users used to the @unittest.skip decorator and therefore
it is best to bail out with a clean error when it happens.
The pytest equivalent of @unittest.skip is @pytest.mark.skip .
Adapt existing tests that were actually relying on this behaviour and add a
test that explicitly test that collection fails.
fix #607
2016-06-24 20:56:21 +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
61992b4e22
Implement --setup-plan option
2016-06-22 16:45:36 +02:00
Vasily Kuznetsov
5e0d78f4f1
Fix .format string failures on python 2.6
2016-06-22 14:53:37 +02:00
Ronny Pfannschmidt
083f64100d
merge master into features
2016-06-22 14:39:33 +02:00
Vasily Kuznetsov
2c5c4f3f78
Add printing of fixture dependencies
2016-06-22 12:54:36 +02:00
Steffen Allner
2c6cfa42fa
Disable capturing for setuponly output
2016-06-22 12:14:35 +02:00
Steffen Allner
92bcc36266
Refactor logging of fixtures
2016-06-22 12:01:51 +02:00
Steffen Allner
499c9551c8
Implement working version of --setuponly
2016-06-22 09:42:45 +02:00
Bruno Oliveira
c3ee1c17bc
Merge pull request #1620 from tomviner/issue460/parameterized-subrequest
...
Issue 460: Fail on getfuncargvalue(<fixture with params>)
2016-06-21 13:43:06 -03:00
Dave Hunt
ef9dd14963
Introduce pytest command as recommended entry point
...
Fixes #1629
2016-06-21 16:16:57 +02:00
Oliver Bestwalter
2b5c2f3ed5
help the user in the rare case this assertion actually fails
2016-06-21 14:57:48 +02:00
Tom Viner
5854a71ece
Issue 460: getfuncargvalue fixture w. params err
2016-06-21 11:29:21 +02:00
palaviv
f8d4cadc3d
Added versionchanged directives
2016-06-19 23:56:43 +03:00
palaviv
c29130d400
Updated documentation
2016-06-19 23:34:42 +03:00
palaviv
ca093673fb
pytest.raises accept cutom message only when used as context manager
2016-06-19 21:24:47 +03:00
palaviv
d21886c005
pytest.raises accpets custom message
2016-06-16 20:15:32 +03:00
Bruno Oliveira
308396ae3c
Merge pull request #1606 from hackebrot/show-fixtures-per-test
...
Show fixtures per test
2016-06-14 09:54:18 -03:00
Raphael Pierzina
adc50ac72f
Change format for test function locations
2016-06-12 15:58:32 +01:00
Raphael Pierzina
b99aace8a9
Fix py26 by using indices in str.format
2016-06-12 00:52:03 +01:00
Raphael Pierzina
7eea168106
Implement show_fixtures_per_test and add cli flag
2016-06-12 00:20:06 +01:00
Bruno Oliveira
bdc29968b8
Remove dead code and simplify code in call_fixture_func
2016-06-08 21:07:56 -03:00
Bruno Oliveira
98acda426f
Remove yieldctx variable being passed around
2016-06-08 21:07:50 -03:00
Bruno Oliveira
d712428d33
Fix custom name for yield_fixtures
2016-06-08 21:07:49 -03:00
Bruno Oliveira
366879db27
Make normal fixtures work with "yield"
2016-06-08 21:07:47 -03:00
Ronny Pfannschmidt
b5bd4d959d
merge master to features
2016-06-01 08:13:26 +02:00
Raphael Pierzina
0d80a9c729
Change _showfixtures_main to loop over fixturedefs
2016-05-31 11:47:16 +01:00
Ronny Pfannschmidt
afc5c7e4f6
better message for empty argument skip
...
include the argument names to help determining the fixture/parametrization
2016-05-30 14:42:55 +02:00
Ronny Pfannschmidt
03eb9203fd
remove the old empty argument triggers
...
unlike the marker based one its not composable
2016-05-30 14:41:00 +02:00
Ronny Pfannschmidt
d217b52508
fix #510 by adding a describing skip marker on empty parameterize
2016-05-30 14:34:38 +02:00
Ronny Pfannschmidt
eab762ea99
Merge branch 'master' into merge-master
2016-05-13 19:37:41 +02:00
Benjamin Dopplinger
75abfbe8d4
Fix typo in doc
2016-04-28 14:40:17 +10:00
Ronny Pfannschmidt
6cc56b4a1b
Merge pull request #1535 from palaviv/parametrize-test-ids-hook
...
introduce pytest_make_parametrize_id hook
2016-04-27 16:16:16 +02:00
palaviv
9733127951
pytest_make_parametrize_id receive config object
2016-04-26 10:23:57 +03:00
palaviv
b9faf78d51
Added test_pytest_make_parametrize_id
2016-04-25 17:48:28 +03:00
palaviv
79927428d1
Added pytest_make_parametrize_id hook
2016-04-25 17:11:47 +03:00
Omar Kohl
56855893ca
Raise CollectError if import test module fails
...
One of the reasons for failing to import the test module is invalid Python
identifiers in the full package path of the test module.
fix #1426
2016-04-23 13:50:48 +02:00
Ceridwen
23a8e2b469
Add .hypothesis to .gitignore and try an older version of Hypothesis for 2.6
2016-04-02 11:47:37 -04:00
Ceridwen
491b30c5d9
Add Hypothesis test for _idval and fix bug it found
2016-04-01 22:45:44 -04:00
Ceridwen
9b438d56e8
Fix a test_unicode_idval_python2 (now test_unicode_idval) and associated string handling on Python 3
2016-04-01 12:27:17 -04:00
palaviv
c66aedfa65
checking first there are duplciates ids before changing to unique names
2016-03-23 18:47:27 +02:00
palaviv
b8c15a0215
improved idmaker name selection in case of duplicate ids
2016-03-23 00:20:58 +02:00
Ceridwen
1f46015de5
Merge remote-tracking branch 'upstream/features' into features
2016-03-22 16:22:00 -04:00
Ceridwen
4405dd0ffe
Escape both bytes and unicode strings for "ids" in Metafunc.parametrize
2016-03-22 01:31:48 -04:00
palaviv
7885e43b78
Merge remote-tracking branch 'upstream/features' into allow-none-as-parametrized-test-id
2016-03-20 18:57:17 +02:00
palaviv
32f44ce2fd
updated parametrize documentation
2016-03-20 18:54:48 +02:00
palaviv
be1954afbc
allow None to be passed in ids list for specific test and recieve idmaker name for test
2016-03-19 21:22:49 +02:00
Bruno Oliveira
5fcce8a7d6
Merge branch 'master' into merge-master-into-features
2016-03-18 18:26:56 -03:00
Kale Kundert
5ceee08590
Fix CHANGELOG merge conflicts.
2016-03-14 11:55:50 -07:00
Kale Kundert
0dcc862a56
Fix some typos in the documentation.
2016-03-14 11:38:00 -07:00
Kale Kundert
9e7206a1cf
Fix a few stylistic issues.
2016-03-14 11:29:45 -07:00
Kale Kundert
916c0a8b36
Fix Decimal() and __ne__() errors.
2016-03-11 16:29:18 -08:00
Kale Kundert
078448008c
Discuss alternative float comparison algorithms.
2016-03-11 15:59:48 -08:00
Kale Kundert
42a7e0488d
Properly handle inf, nan, and built-in numeric types.
...
This commit also:
- Dramatically increases the number of unit tests , mostly by borrowing
from the standard library's unit tests for math.isclose().
- Refactors approx() into two classes, one of which handles comparing
individual numbers (ApproxNonIterable) and another which uses the
first to compare individual numbers or sequences of numbers.
2016-03-11 08:49:26 -08:00
Mike Lundy
9577120592
Allow custom fixture names for fixtures
...
When defining a fixture in the same module as where it is used, the
function argument shadows the fixture name, which a) annoys pylint and
b) can lead to bugs where you forget to request a fixture into a test
method.
This allows one to define fixtures with a different name than the name
of the function, bypassing that problem.
2016-03-09 14:58:54 -08:00
Kale Kundert
7d155bd3cf
Fix sys.version_info errors.
2016-03-08 10:12:31 -08:00
Kale Kundert
6a902924f8
Fix trailing whitespace errors.
2016-03-07 19:56:23 -08:00
Kale Kundert
c9c73b8d8e
Fix zero-length field name error in python2.6
2016-03-07 19:54:43 -08:00
Kale Kundert
5dab0954a0
Add approx() to the Sphinx docs.
2016-03-07 18:14:49 -08:00
Kale Kundert
b8a8382c2c
Reduce the default absolute error threshold to 1e-12.
2016-03-07 16:43:53 -08:00
Kale Kundert
bf97d5b817
Use the plus/minus unicode symbol in the repr string.
...
This was a challenge because it had to work in python2 and python3,
which have almost opposite unicode models, and I couldn't use the six
library. I'm also not sure the solution I found would work in python3
before python3.3, because I use the u'' string prefix which I think was
initially not part of python3.
2016-03-07 16:40:41 -08:00
Kale Kundert
dd28e28b34
Make a few stylistic improvements.
2016-03-07 10:10:54 -08:00
Kale Kundert
6f5e1e386a
Add a convenient and correct way to compare floats.
2016-03-07 10:10:54 -08:00
Ronny Pfannschmidt
6d4b14d7ee
Merge pull request #1438 from Bachmann1234/issue-1437
...
Make a good faith effort to display a bytestring when one is provided…
2016-03-06 06:48:32 +01:00
Matt Bachmann
8ce32b0795
When a regex pattern contains bytes instead of a string use escape_encode to turn it into a string before further processing. Thanks @nicoddemus for the review and tips!
2016-03-05 21:04:34 -05:00
Bruno Oliveira
24d3e01548
pytest.fail with non-ascii characters raises an internal pytest error
...
Fix #1178
2016-03-05 16:09:01 -03:00
Anatoly Bubenkov
cf9a09e988
catch IndexError exceptions when getting exception source location
2016-02-26 08:18:12 -04:00
Georgy Dyuldin
79722ae89b
Add expected exceptions to 'DID NOT RAISE' msg
2016-02-03 14:12:41 +03:00
Bruno Oliveira
a912d3745b
Moved py.code code over to py.test
...
Fix #103
2016-01-25 23:18:04 -02:00
Bruno Oliveira
7b13c4bec0
Fix flakes
2016-01-14 21:01:57 -02:00
aselus-hub
ec02f694ef
Update python.py
...
updated dictionary itteration to create a list for generation, so that tests can be added in the generator functions under python3. This works fine as-is in python2 because python 2 already creates a list, whereas python3 returns an itterator. Forcing a list format for the return fixes python3 to work the same way as python2
2015-12-09 11:32:19 -08:00
Ronny Pfannschmidt
b5d65e5139
Merge pull request #1206 from The-Compiler/collect-getattr
...
Don't collect classes with truthy __getattr__.
2015-11-30 17:23:47 +01:00
Florian Bruhin
ba9146c131
Don't collect classes with truthy __getattr__.
...
When we have a metaclass which returns something truthy (like a method) in its
__getattr__, we collected the class because pytest thought its __test__
attribute was set to True.
We can work around this to some degree by assuming __test__ will always be set
to an explicit True if that's what the user has intended, and if it's something
other than that, this is probably a mistake.
Fixes #1204 .
2015-11-30 16:41:13 +01:00
Florian Bruhin
c790f7475e
Fix getting line number with nasty __getattr__.
...
When an object has a custom __getattr__ which always returns a non-int, we
tried to get compat_co_firstlineno from it and checked it was a integer, which
caused an exception if such a class is mistakenly collected.
If we still mistakenly collect such a class (which is likely to be something
other than a test), we now skip it with a warning (because it probably has an
__init__) instead of producing an error.
See #1204 .
2015-11-30 16:13:15 +01:00
Bruno Oliveira
311b0a9683
Fix situation where a traceback entry "path" returns a str object
...
Fix #1133
2015-10-16 20:18:14 -03:00
Michael Birtwell
a3bda59a30
collection: Prevent non-function callables from being collected
...
Fixes issue 331
previously to this change the collection code would issue a warning for
when ever it encountered a variable that looked like a test but wasn't a
function saying that it wouldn't collect it because it wasn't a function.
This fixes the logic so that if that warning is issued it really isn't
collected.
However previously special cases existed to support tests that were
created using functools.wraps and functools.partial. So the condition for
issuing that warning has been updated to take that in to account
Also try the old way of detecting functions just for proper integration
with mock.path in python 2.7 the get_real_func returned the unbound method
2015-10-12 22:23:18 +01:00
TomV
88c8dd96f9
issue1035 Override inspect.isclass for python 2.6
2015-10-09 19:44:47 +01:00
Demian Brecht
493530ec6d
typo fix, changed position of context manager notes
2015-10-05 12:13:25 -07:00
Bruno Oliveira
5171d167ce
Move "note" to the end of the main text
...
Fix #1097
2015-10-02 18:14:17 -03:00
Demian Brecht
2981bece55
pyflakes fix
2015-10-02 13:03:43 -07:00
Demian Brecht
fd211bf490
Add a note about usage of the context manager
...
Addesses #1097
2015-10-02 12:40:58 -07:00
Bruno Oliveira
f3cee8f0b5
Merge remote-tracking branch 'upstream/master' into param-ids-fix
2015-10-01 07:58:55 -03:00
Bruno Oliveira
d1e00f6e19
Detect dynamic code explicitly in filter_traceback
2015-09-30 17:32:49 -03:00
Bruno Oliveira
c9480c5b8b
Move imports outside _escape_bytes as suggested in review
2015-09-30 17:02:19 -03:00
Bruno Oliveira
11f100813e
Fix internal error when filtering tracebacks where one entry was generated by an exec() statement
...
Fix #995
2015-09-29 22:29:43 -03:00
Bruno Oliveira
b64470443f
Fix SystemError when using unicode_escape on Python 3
...
Fix #1087
2015-09-29 18:20:30 -03:00
Bruno Oliveira
8633c4cefd
Fix encoding errors for parametrized tests with unicode parameters in py2
...
Fix #1085
2015-09-29 17:57:49 -03:00
holger krekel
1c0ffc5caf
seems like pypy's callable builtin calls __getattr__ so we do the check
...
later.
2015-09-28 14:02:30 +02:00
Bruno Oliveira
e1063678f1
escape bytes when creating ids for parametrized values
2015-09-22 23:18:09 -03:00
holger krekel
ca460e11e6
Merge pull request #1051 from Akasurde/issue_1027
...
Added minor documentation change in python.py
2015-09-22 17:09:25 +02:00
Abhijeet Kasurde
dc1ce51ac2
Added minor documentation change
...
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2015-09-22 20:15:49 +05:30
holger krekel (rather uses bitbucket/hpk42)
3bcda48ba4
Merge pull request #1009 from mdboom/deprecation-warnings
...
avoid deprecation warnings, introduce helpers.
2015-09-17 13:37:26 +02:00
holger krekel
a62d12634c
revert importing test module behaviour to prepend by default
2015-09-16 22:12:20 +02:00
Michael Droettboom
bf74401fd3
Use __code__.co_argcount
2015-09-16 11:05:54 -04:00
Michael Droettboom
08a572086b
Fix lookup of special values
2015-09-16 11:02:36 -04:00
Michael Droettboom
9c19728d2b
Fix checking for args
2015-09-16 06:45:51 -04:00
Michael Droettboom
859259ddae
Simplify
2015-09-16 06:43:16 -04:00
Michael Droettboom
a0cefb3213
Use inspect.signature instead of inspect.getargspec
2015-09-16 06:33:53 -04:00
Bruno Oliveira
0b3f1b4a7c
Create `_pytest.vendored_packages` and _pytest._pluggy
...
- Replace imports from "pluggy" to "_pytest._pluggy"
- Fallback to import "pluggy" from global namespace if
not found in _pytest.vendored_packges
2015-09-07 13:01:54 -03:00
Florian Bruhin
885e461ae3
Fix overriding of fixtures with parametrization.
...
Fixes #979 , see #926 .
2015-08-31 14:38:39 +02:00
elizabeth
e67d66a5d4
Merge branch 'pytest-dev'
...
# Conflicts:
# AUTHORS
2015-08-24 22:55:11 +03:00
elizabeth
06585f5bdd
Always report error about parametrize data that doesn't correspond to fixtures in test functions.
2015-08-23 13:42:40 +03:00
Markus Unterwaditzer
41cef6f5f2
Don't skip fixtures that are substrings of params
...
Bug introduced with
https://bitbucket.org/pytest-dev/pytest/pull-requests/257/allow-to-override-parametrized-fixtures
Fix #736
2015-08-11 00:41:21 +02:00
TomV
353360dbe5
use local isclass
2015-08-09 00:11:15 +01:00
TomV
3497aa0766
check nose.istest __test__ attr issue526
2015-08-09 00:11:15 +01:00
Bruno Oliveira
729b5e9b2f
Merge pull request #923 from The-Compiler/parametrize-idfunc
...
Generate parametrize IDs for enum/re/class objects.
2015-08-08 15:09:54 -03:00
Florian Bruhin
4e21d1d77b
Move enum import and adjust comments.
2015-08-08 15:25:10 +02:00
Florian Bruhin
84fdba129a
More style changes.
2015-08-08 12:57:54 +02:00
Florian Bruhin
18125c7d1f
Clean up type comparisons.
2015-08-07 23:10:22 +02:00
Florian Bruhin
b59376bea4
Alert user about other parametrize spellings.
2015-08-07 07:51:59 +02:00
Florian Bruhin
13c5456868
Generate parametrize IDs for enum/re/class objects.
2015-08-07 07:37:59 +02:00
elizabeth
f7bacd169e
Update docs
2015-08-04 00:48:41 +03:00
elizabeth
657ca97dbd
Some refactorings after code review
2015-08-04 00:02:03 +03:00
elizabeth
9846953597
Support for python 2.6
2015-08-02 17:28:27 +03:00
elizabeth
2fc7aede0b
Request #714 : Apply indirect=True on particular argnames
2015-08-02 16:40:40 +03:00
Eric Hunsberger
52b4eb6c46
Added `warns` to assert warnings are thrown
...
Works in a similar manner to `raises`, but for warnings instead
of exceptions. Also refactored `recwarn.py` so that all the
warning recording and checking use the same core code.
2015-07-30 23:28:32 -04:00
jakubo
e8f4819876
Test file run twice fails if it contains marked class #683
2015-07-26 12:15:29 +02:00
Bruno Oliveira
df29120abe
Merge branch 'pytest-2.7'
...
Conflicts:
_pytest/config.py
_pytest/genscript.py
_pytest/mark.py
tox.ini
2015-07-23 22:35:51 -03:00
Bruno Oliveira
ce96973ed5
Merge pull request #864 from pytest-dev/consider-color-yes-everywhere
...
Consider --color option in more places which deal with TerminalWriters
2015-07-23 08:03:52 -03:00
Bruno Oliveira
31cfbac1f4
Fix autouse fixtures defined in a TestCase subclass
2015-07-20 19:28:54 -03:00