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
707226298a
issue1035 add test for classes setting __getattr__
2015-10-08 09:08:32 +01: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
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
Bruno Oliveira
e1063678f1
escape bytes when creating ids for parametrized values
2015-09-22 23:18:09 -03:00
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
Michael Droettboom
7f71ce0ab2
Reorganize tests
2015-09-16 16:52:37 -04:00
holger krekel
a62d12634c
revert importing test module behaviour to prepend by default
2015-09-16 22:12:20 +02:00
Michael Droettboom
9a84c9edb6
Add tests for argument formatting
2015-09-16 11:02:48 -04:00
Ronny Pfannschmidt
cd475c7b27
minor flake8 fixes
2015-09-13 19:55:44 +02:00
Florian Bruhin
19791546da
Add docstring.
2015-08-31 15:11:57 +02:00
Florian Bruhin
885e461ae3
Fix overriding of fixtures with parametrization.
...
Fixes #979 , see #926 .
2015-08-31 14:38:39 +02:00
Brianna Laugher
b49bedcf0c
Merge branch 'master' of git://github.com/Elizaveta239/pytest into Elizaveta239-master
2015-08-28 11:10:22 +10: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
Bruno Oliveira
2ffd37b816
return non-zero exit code if no tests are collected
...
Fix #812
Fix #500
2015-08-18 07:35:02 -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
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
Brianna Laugher
36b86af4b9
Added more test cases
2015-08-08 19:20:09 +02:00
Brianna Laugher
40fa7b25c5
Merge branch 'master' of git://github.com/Elizaveta239/pytest into Elizaveta239-master
...
Fixed merge conflict in CHANGELOG
2015-08-08 18:54:53 +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
657ca97dbd
Some refactorings after code review
2015-08-04 00:02:03 +03:00
elizabeth
db9809d6dc
Update test for error in 'indirect' parameter
2015-08-02 23:53:44 +03:00
elizabeth
63bac67fb5
Add test for bad value in argument 'indirect'
2015-08-02 23:06:24 +03:00
elizabeth
15b865f502
Rewrite test using @pytest.fixture
2015-08-02 20:30:23 +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
Florian Bruhin
2ab4bf13ab
Document and test stacking of parametrize.
...
Closes #815 .
2015-07-26 14:39:13 +02:00
Jan Bednařík
f78d87ee38
Issue #751 - test.
2015-07-25 15:38:11 +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
Anatoly Bubenkov
6af7172204
Merge branch 'pytest-2.7'
2015-07-19 15:25:04 +02:00
Bruno Oliveira
2f7d0f8bd9
Consider --color option in more places which deal with TerminalWriters
2015-07-18 16:39:55 -03:00
Bruno Oliveira
dcdc823dd2
Support for tests created with functools.partial
...
Fix #811
2015-07-16 20:37:03 -03:00
Bruno Oliveira
0f52856f99
Use a subdirectory in the TEMP directory to speed up tmpdir creation
...
Fix #105
2015-07-15 20:03:58 -03:00
Bruno Oliveira
5ec2a17f08
--fixtures only shows fixtures from first file
...
Fix #833
2015-07-12 17:32:39 -03:00
holger krekel
ee40ea5f6d
Merge branch 'pytest-2.7'
...
Conflicts:
AUTHORS
_pytest/__init__.py
setup.py
testing/conftest.py
tox.ini
2015-06-23 16:49:05 +02:00
Bruno Oliveira
eb73db56c7
Fix issue where pytest.raises() doesn't always return Exception instance in py26
...
Fixes #767
2015-06-19 07:46:47 -03:00
holger krekel
bddc88f09e
adapt to pluggy naming, rename pytest.hookspec_opts to pytest.hookspec,s ame with hookimpl_opts
...
--HG--
branch : pluggy1
2015-05-06 10:08:08 +02:00
holger krekel
9aec5cd52d
use runpytest() instead of runpytest_inprocess if a test can run as subprocess as well
...
--HG--
branch : testrefactor
2015-04-28 12:05:08 +02:00
holger krekel
db5649ec6a
streamline pytester API majorly:
...
- integrate conftest into pytester plugin
- introduce runpytest() to either call runpytest_inline (default) or
runpytest_subprocess (python -m pytest)
- move testdir.inline_runsource1 to pdb tests
- strike some unneccessary methods.
- a new section "writing plugins" and some better pytester docs
--HG--
branch : testrefactor
2015-04-28 11:54:53 +02:00
holger krekel
a8afba054a
- refine lsof checking
...
- make runpytest() create an inline testing process instead of
a subprocess one
--HG--
branch : testrefactor
2015-04-28 11:54:46 +02:00
holger krekel
d3e363b97a
- make API between runpytest() and inline_run() more similar
...
- shift a number of tests to become inline_run() tests
--HG--
branch : testrefactor
2015-04-28 11:54:45 +02:00