Bruno Oliveira
42a5d6bdfa
Add __future__ imports to all pytest modules
...
This prevents silly errors from creeping in Python 2 when testing in Python 3
2017-03-16 22:45:40 -03:00
Patrick Hayes
58ce3a9e8c
Safer sys.modules delete
2017-02-14 16:54:32 -08:00
Bruno Oliveira
bc0f7e6243
Fix false-positive assert rewrite warnings when using 'pytest_plugins'
...
pytest would emit false positive warnings about assertion-rewrite when a
module appears multiple times in plugins which depend
on other plugins using the 'pytest_plugins' mechanism
2016-12-01 15:50:08 -02:00
Ronny Pfannschmidt
a5b5090c72
Merge pull request #2070 from nedbat/bug2038
...
Don't fail if imp can't find the source for a .pyc file. #2038
2016-11-22 17:45:29 +01: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
Ned Batchelder
06bb61bbe3
Don't fail if imp can't find the source for a .pyc file. #2038
2016-11-20 13:09:32 -05:00
Bruno Oliveira
2a2b8cee09
Fix false-positive warnings from assertion rewrite hook
...
Fix #2005
2016-10-20 21:40:57 -02:00
Bruno Oliveira
6711b1d6ab
Rewrite asserts in test-modules loaded very early in the startup
...
Also now match modules which start with any of the names registered
using register_assert_rewrite as discussed in #1787
Fix #1784
2016-08-03 12:49:48 -03:00
Floris Bruynooghe
743f59afb2
Introduce pytest.register_assert_rewrite()
...
Plugins can now explicitly mark modules to be re-written. By default
only the modules containing the plugin entrypoint are re-written.
2016-07-13 17:31:09 +01:00
Floris Bruynooghe
944da5b98a
Avoid rewrite warning for inline runs
...
When running pytest inline/inprocess we plugins have already been
imported and re-writen, so avoid the warning.
2016-07-13 17:29:19 +01:00
Floris Bruynooghe
a98e3cefc5
Enable re-writing of setuptools-installed plugins
...
Hook up the PEP 302 import hook very early in pytest startup so
that it gets installed before setuptools-installed plugins are
imported. Also iterate over all installed plugins and mark them
for rewriting. If an installed plugin is already imported then
a warning is issued, we can not break since that might break
existing plugins and the fallback will still be gracefull to
plain asserts.
Some existing tests are failing in this commit because of the new
warning triggered by inline pytest runs due to the hypothesis
plugin already being imported. The tests will be fixed in the next
commit.
2016-07-13 17:29:19 +01:00
Ronny Pfannschmidt
b9a91dc112
merge from master to features
2016-07-06 11:51:48 +02:00
Bruno Oliveira
58e558141d
Remove commented out code
2016-06-26 21:19:07 +02:00
Vasily Kuznetsov
c17027e576
Warn about asserts on tuples ( fixes #1562 )
2016-06-25 19:21:48 +02:00
RedBeardCode
e2f550156e
Improve of the test output for logical expression with brackets.
...
Fixes #925
2016-06-25 18:10:36 +02:00
Bruno Oliveira
819942e964
Return explicit None from rewrite hook's find_module
2016-06-21 12:28:36 +02:00
Floris Bruynooghe
9118c0222f
Merge .set_config() into constructor
2016-06-21 09:28:10 +02:00
Bruno Oliveira
3a81d2e012
conftest files now use assertion rewriting
...
Fix #1619
2016-06-20 23:13:29 +02:00
TomV
7d107018e8
Fix #1290 : Py3.5's @ operator/assertion rewriting.
2016-02-05 23:09:57 +00:00
Florian Bruhin
2956627b8b
Handle EPERM when writing rewritten bytecode.
...
Fixes #1143 .
2015-10-17 11:55:55 +02:00
Thomas Kluyver
4462b83258
Style fix
2015-07-16 11:04:36 -07:00
Thomas Kluyver
195422f9c0
Fix AST rewriting with starred expressions in function calls
2015-07-15 15:31:35 -07:00
Matthias Bussonnier
167625d24d
simplify + fix
2015-07-15 13:49:40 -07:00
Matthias Bussonnier
26e64fc45c
Ast Call signature changed on 3.5
...
fix issue 744 on bitbucket
port of merge request 296
https://bitbucket.org/pytest-dev/pytest/pull-request/296/astcall-signature-changed-on-35
https://bitbucket.org/pytest-dev/pytest/issue/744/
2015-07-15 13:49:40 -07:00
Bruno Oliveira
7445c5bd70
Add support for PEP302 get_data API
...
Fix #808
2015-07-11 14:13:43 -03:00
Benjamin Peterson
f3ad2e4ad2
use NameConstant node when it exists ( fixes #735 )
...
--HG--
branch : issue735
2015-06-03 18:07:10 -05:00
Daniel Hahler
c629f6b18b
Fix `reload()` with modules handled via `python_files`
...
If a module exists in `sys.modules` already, `load_module` has to return it.
Fixes https://bitbucket.org/pytest-dev/pytest/issue/435
--HG--
branch : fix-reload
2015-03-04 16:21:27 +01:00
TomV
f6caf230f8
fix for issue615: _format_boolop must escape %
...
fix test for issue615: expression must eval False
--HG--
branch : format_boolop_percent6
2014-10-27 08:57:58 +00:00
David Röthlisberger
7371d436d2
Fix assertion.rewrite on read-only filesystem
2014-10-17 21:18:37 +01:00
TomV
857db415bc
fix some spelling mistakes
...
--HG--
branch : some_spelling_fixes
2014-10-13 23:16:26 +01:00
Anatoly Bubenkov
a759da0208
Escape % character in the assertion message. closes #604
2014-10-07 01:01:21 +02:00
holger krekel
79d2edcbff
Merged in flub/pytest (pull request #207 )
...
Show both user assertion msg as explanation (issue549)
2014-09-22 19:16:10 +02:00
Benjamin Peterson
c0f091d540
remove debugging turd
2014-09-01 16:51:44 -04:00
Benjamin Peterson
d4cd1aad8e
improvements to rewrite cache invalidation
...
- stat the source path before it is read.
- Validate the source size in addition to mtime.
2014-09-01 16:51:27 -04:00
Floris Bruynooghe
37bd1e03cb
Show user assertion messages and instrospection together
...
User provided messages, or any valid expression given as second
argument to the assert statement, are now shown in addition to the
py.test introspection details. Formerly any user provided message
would entirely replace the introspection details.
Fixes issue549.
2014-08-23 18:14:25 +02:00
Floris Bruynooghe
79c2a47985
Improve the docstring further
2014-08-23 12:10:16 +02:00
Floris Bruynooghe
e7ed45a5d4
Explain why this is important
2014-08-19 20:50:25 +02:00
Floris Bruynooghe
424479cf0f
Escape newlines in repr for assertion rewriting
...
The assertion formatting mini-language depends on newlines being
escaped. Unfortunately if the repr of an object contained
newlines the rewriting module did not escape those, which is now
fixed.
Fixes issue453.
2014-08-18 20:07:38 +02:00
holger krekel
d16fdb378c
merge PR192, streamline a bit.
2014-08-07 10:42:23 +02:00
Bruno Oliveira
cc092afd3b
updated CHANGELOG and trace error message as requested in review
...
fixes issue #437
--HG--
branch : assertionrewrite-currupted-pyc
2014-08-04 20:38:50 -03:00
Bruno Oliveira
fd4485a540
Fixed assertionrewrite._read_pyc to handle corrupted pyc files properly
...
This seems to be the cause for issues #437 and #301 .
--HG--
branch : assertionrewrite-currupted-pyc
2014-08-02 18:01:28 -03:00
Jurko Gospodnetić
9fb2079458
replace py.test module references with pytest
...
The only remaining 'py.test' references are:
* those referring to the 'py.test' executable
* those in code explicitly testing py.test/pytest module compatibility
* those in old CHANGES documentation
* those in documentation generated based on external data
* those in seemingly unfinished & unmaintained Japanese documentation
Minor stylistic changes and typo corrections made to documentation next to
several applied py.test --> pytest content changes.
2014-01-18 12:31:33 +01:00
Floris Bruynooghe
db778fd456
Correct comment
2013-11-22 12:27:34 +00:00
Virgil Dupras
e118682db1
Added test for previous crash on failed import fix
...
Also, rewrote the fix a bit.
ref #383 .
2013-11-15 14:03:57 -05:00
Virgil Dupras
ded88700a3
Fix TypeError crash on failed imports under py3.3.
...
Starting with Python 3.3, NamespacePath passed to importlib hooks
seem to have lost the ability to be accessed by index.
We wrap the index access in a try..except and wrap the path in a
list if it happens.
Fixes #383 .
2013-11-08 16:59:13 -05:00
holger krekel
8ac5af2896
fix flakes issues and make --flakes run part of tox runs
2013-10-12 15:39:22 +02:00
Jason R. Coombs
ee5b836e27
Implement suggestions by HPK
2013-10-10 17:39:37 -04:00
Jason R. Coombs
a4c17dfb19
Register the AssertionRewritingHook loader with pkg_resources; fixes #366 .
2013-10-10 11:56:12 -04:00
Benjamin Peterson
56e6ae567c
fix detection of the coding cookie when it is on the second line of the file ( fixes #330 )
2013-10-05 15:16:08 -04:00
Benjamin Peterson
33b663e03d
fix coding cookie detection logic
2013-10-05 15:03:04 -04:00