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
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
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
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
Marc Abramowitz
555ba4159d
Simplify tests; don't use u literal not supported in py32
...
--HG--
branch : makepyfile_utf8
2014-03-28 12:11:33 -07:00
Marc Abramowitz
f47ae74981
Make makepyfile accept UTF-8 so a few cookie tests in test_assertrewrite.py
...
don't need to be dedented.
--HG--
branch : makepyfile_utf8
2014-03-28 09:44:18 -07:00
Marc Abramowitz
17d7c60735
test_sys_meta_path_munged: Simplify with makepyfile
...
--HG--
branch : sys_meta_path_remove_hook_only_if_present
2014-03-28 01:03:52 -07:00
Marc Abramowitz
81f822d528
Only try to remove hook from sys.meta_path if it's present
...
Prevent error on exit if some code messes with sys.meta_path and removes the
assertionrewrite hook (CaptureMock seems to do this):
File "/Users/marca/dev/hg-repos/pytest/_pytest/assertion/__init__.py", line 64, in pytest_unconfigure
sys.meta_path.remove(hook)
ValueError: list.remove(x): x not in list
--HG--
branch : sys_meta_path_remove_hook_only_if_present
2014-03-28 00:33:12 -07:00
holger krekel
8a3b4b9c37
require py>=1.2.20
2014-01-29 13:11:40 +01:00
holger krekel
505a34bb85
fix flakes failures
2014-01-29 10:20:13 +01:00
Andreas Pelme
fe4cdd8a90
fixed issue428: Skip test for packages without __init__.py on Python 2
...
--HG--
branch : py2_pkg_skip
2014-01-22 14:32:22 +01:00
holger krekel
7f49e0fddc
xfail a test on pypy that checks wrong encoding/ascii (pypy does
...
not error out). fixes issue385.
also re-enable pypy tests in tox.
2013-11-19 11:18:51 +01: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
2697b63bcd
Fix bytes/string mismatch in test on Python 3
2013-10-10 18:01:56 -04:00
Jason R. Coombs
00c0d62c9b
Adding test capturing #366 where an error occurs when package resources are loaded from the test package.
2013-10-10 11:40:31 -04:00
Benjamin Peterson
8b6e42317b
add test for detecting coding cookie with CRLF newlines
2013-10-05 15:20:32 -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
Ronny Pfannschmidt
743711cd1f
fix issue317: assertion rewriter support for the is_package method
2013-08-01 22:11:18 +02:00
holger krekel
9ccd52d538
fix issue305 - ignore any problems in writing a pyc file, but print out a trace.
2013-08-01 15:43:42 +02:00
Erik Bray
17e1106584
reindent a few of the blockquotes in these tests
2013-06-07 17:30:10 -04:00
Erik Bray
b1595d3f61
Adds a test for and fixes #112 . If attempting to write to the __pycache__ directory raises a permission error _write_pyc() should just return False to prevent any further write attempts.
2013-05-28 18:11:12 -04:00
Benjamin Peterson
0cf79b29cd
in the default Python 2 case, manually check the source is ASCII ( fixes #269 )
2013-03-08 10:44:41 -05:00
Benjamin Peterson
65edf87ea6
display the repr of some global names ( fixes #171 )
2013-01-10 11:59:08 -06:00
holger krekel
036557ac18
fix issue206 - unset PYTHONDONTWRITEBYTECODE in assertrewrite test
2012-10-22 11:14:18 +02:00
Benjamin Peterson
099ac1e1f4
cleanup test a bit
2012-07-07 08:01:44 -07:00
Floris Bruynooghe
1aca6c9d7c
Fix extension of of cached re-written file
...
With PYTHONOPTIMIZE set this had the extension of "o" instead of ".pyo".
Fixes issue #168 .
2012-07-07 16:09:53 +02:00
Ronny Pfannschmidt
db8fbe7661
skip test for pyo on pypy since pypy doesnt do pyo
2012-05-22 16:20:58 +02:00
Benjamin Peterson
b4588f1798
escape the % operator in string formatting
2012-05-03 13:49:30 -04:00
Benjamin Peterson
29b4082b00
put the explanation generating code in the conditional fail body ( fixes #79 )
2011-10-14 16:26:13 -04:00
holger krekel
d37af98db3
try to make test suite pass on jython 2.5.1 again
2011-09-21 08:12:37 +02:00
Benjamin Peterson
2bc4065a00
rewrite file newlines when the python parser is picky
2011-09-20 17:53:07 -04:00
Benjamin Peterson
8675cf640d
every boolop operand must have it's own format context ( fixes #69 )
2011-08-30 10:34:21 -04:00
Benjamin Peterson
661a8a4a92
only use the last part of the module name in the filename ( fixes #68 )
2011-08-30 00:12:07 -04:00
Benjamin Peterson
abe080c6b4
use different caches for optimized and unoptimized code ( fixes #66 )
2011-08-29 10:13:00 -04:00
Benjamin Peterson
643ab120f4
only try to create the __pycache__ dir (not a tree to it) fixes #60
...
Also, improve error handling surrounding __pycache__ creation.
2011-07-25 21:40:38 -05:00
Benjamin Peterson
f86c8469f5
now fix py3...
2011-07-19 22:56:34 -05:00
Benjamin Peterson
22335acd09
use binary mode
2011-07-19 22:45:27 -05:00
Benjamin Peterson
8b866aa065
add a newline for window's sake
2011-07-19 22:41:58 -05:00
Benjamin Peterson
2c4964d290
escape '%' in specialized comparison explanations ( fixes #63 )
2011-07-19 21:42:00 -05:00
Benjamin Peterson
ade9b9aa8e
add a test for vararg call
2011-07-14 11:46:32 -05:00
Benjamin Peterson
7576b3c7d0
fix assertion rewriting on calls with a double-star arg
2011-07-14 11:45:42 -05:00
Benjamin Peterson
3cc8697744
respect sys.dont_write_bytecode and PYTHONDONTWRITEBYTECODE
2011-07-13 13:33:54 -05:00
Benjamin Peterson
14ceaf2459
fix assertion rewriting in read-only directories (refs #60 )
2011-07-12 17:09:14 -05:00
Benjamin Peterson
a59c2c9e17
roll test_long_chain in with other boolop tests
2011-07-11 09:24:07 -05:00
Michał Bartoszkiewicz
6096aeca53
Fix a typo in assertion rewriting.
2011-07-11 11:57:47 +02:00
Benjamin Peterson
f286a02582
rewrite with proper short-circuting on boolean operators ( fixes #57 )
2011-06-28 20:21:22 -05:00
Benjamin Peterson
c6e3606c6b
fix the rewriter on relative imports ( fixes #58 )
2011-06-28 10:39:11 -05:00
Benjamin Peterson
8e81ed693a
put explanation simplification in format_explanation so everyone can benefit
2011-06-12 22:41:58 -05:00
Benjamin Peterson
250160b4b0
refactor explanation formatting things into their own module
2011-05-26 12:01:34 -05:00
Benjamin Peterson
f423ce9c01
import assertion code from pylib
2011-05-25 17:54:02 -05:00
Benjamin Peterson
491c05cea7
create the _pytest/assertion package
2011-05-25 16:18:45 -05:00
Benjamin Peterson
c0910abf2f
account py3 range objects
2011-05-24 18:30:18 -05:00
Benjamin Peterson
fa412675fc
use py.builtin.exec_
2011-05-24 18:28:05 -05:00
Benjamin Peterson
0bb84abca7
handle comparison results which raise when asked for their truth value
2011-05-24 18:15:08 -05:00
Benjamin Peterson
76cede83c0
add a way to disable assertion rewriting for a module
2011-05-24 17:30:35 -05:00
Benjamin Peterson
9c4f6791e5
give initial imports a reasonable lineno
2011-05-24 17:21:58 -05:00
Benjamin Peterson
7ba8fee3dc
improve this test
2011-05-20 09:44:36 -05:00
Benjamin Peterson
aae89cd021
correctly handle multiple asserts
2011-05-19 18:56:48 -05:00
Benjamin Peterson
9e6dfaefd9
place assertion imports after __future__ statements and docstrings
2011-05-19 16:53:13 -05:00
Benjamin Peterson
c742e47de0
new assertion debugger which rewrites asserts before they are run
2011-05-18 15:31:10 -05:00