pytest-dev / py Goto Github PK
View Code? Open in Web Editor NEWPython development support library (note: maintenance only)
License: MIT License
Python development support library (note: maintenance only)
License: MIT License
Some Subversion-related tests fail. This problem might be related to Subversion 1.7.*. I use py 1.4.5 and Subversion 1.7.1. I'm attaching logs of testing/path/test_svnurl.py and testing/path/test_svnwc.py.
py.path.local.LocalPath.join calls str on its *args. This does not work for unicode filenames.
As far as I can see, py/_apipkg.py in pylib 1.4.14 is identical to apipkg.py version 1.2. Would it be possible to unbundle it?
Background: Fedora has a policy that forbids bundling of libraries in its packages:
http://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries
The related Fedora bug against python-py is
https://bugzilla.redhat.com/show_bug.cgi?id=790163
Updating buildout updated py, which fails on 2.4:
Traceback (most recent call last):
File "/var/opt/zope210/plone3_dev/eggs/py-1.4.20-py2.4.egg/py/_apipkg.py", line 124, in __makeattr
result = importobj(modpath, attrname)
File "/var/opt/zope210/plone3_dev/eggs/py-1.4.20-py2.4.egg/py/_apipkg.py", line 47, in importobj
module = __import__(modpath, None, None, ['__doc__'])
File "/var/opt/zope210/plone3_dev/eggs/py-1.4.20-py2.4.egg/py/_path/svnwc.py", line 401, in ?
class SvnWCCommandPath(common.PathBase):
File "/var/opt/zope210/plone3_dev/eggs/py-1.4.20-py2.4.egg/py/_path/svnwc.py", line 822, in SvnWCCommandPath
class Checkers(py.path.local.Checkers):
File "/var/opt/zope210/plone3_dev/eggs/py-1.4.20-py2.4.egg/py/_apipkg.py", line 124, in __makeattr
result = importobj(modpath, attrname)
File "/var/opt/zope210/plone3_dev/eggs/py-1.4.20-py2.4.egg/py/_apipkg.py", line 47, in importobj
module = __import__(modpath, None, None, ['__doc__'])
File "/var/opt/zope210/plone3_dev/eggs/py-1.4.20-py2.4.egg/py/_path/local.py", line 533
yield old
SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause
Looking at the commit history this change went into 1.4.16. I pinned py=1.4.15 in my buildout and all is well again. If python 2.4 is no longer supported, fine, but this should be documented, and mentioned to use 1.4.15.
Which Python versions are supported is confusing, because 7f37ee0 (1.4.10) removed 2.4 from install.txt, but the changelog for 1.4.12 mentions fixing Python 2.4.
it expects cmp to work for the callable case,
which means it wont work on python3 for that case
This failure occurs when running whole test suite, not only testing/log/test_log.py file.
If running test suite without PYTHONDONTWRITEBYTECODE="1", then deletion of ignored files (using e.g. hg st -i | awk '{print $2}' | xargs rm
) is needed before running test suite again to reproduce failure.
$ PYTHONDONTWRITEBYTECODE="1" PYTHONPATH="$(pwd)" PYTHONWARNINGS="d" py.test-3.4
...
=================================== FAILURES ===================================
___________________ TestLogConsumer.test_log_default_stderr ____________________
self = <log.test_log.TestLogConsumer object at 0x7fa29cefc940>
def test_log_default_stderr(self):
res, out, err = callcapture(py.log.Producer("default"), "hello")
> assert err.strip() == "[default] hello"
E assert '/tmp/py/py/_...efault] hello' == '[default] hello'
E - /tmp/py/py/_io/capture.py:298: ResourceWarning: unclosed file <_io.TextIOWrapper name=27 mode='r+' encoding='UTF-8'>
E - sys.stdin = self.in_ = DontReadFromInput()
E [default] hello
testing/log/test_log.py:71: AssertionError
pdb = py.std.pdb in pytests pdb plugin did fail for fijal and no debuggin was availiable
py.path.local.make_numbered_dir() has a race condition that only shows up if more than "keep" processes start up at exactly the same time (which could occur when starting tests in parallel).
The fix I provide here, while not theoretically perfect, should be good enough. It prevents very recent directories from being deleted (even if they don't have (yet?) a .lock file in them). For what "very recent" means, I suppose that any value greater than 1 second is good enough, but I personally like to have enough time to get a chance to copy a directory that I want to keep, so the patch uses 5 minutes as the default.
https://bitbucket.org/pypy/pypy/commits/c6f52c21fe7e0e5385764cb5b1013cfbc39884be
Bitbucket: https://bitbucket.org/pytest-dev/py/issue/3
Originally reported by: @jurko-gospodnetic
Originally created at: 2011-02-13T12:59:00.667
I just noticed that the py.path.local strpath member is not documented on 'http://pylib.org/path.html'.
It is documented for py.path.svnwc.SvnWCCommandPath but not for the local path class.
Hope this helps.
Best regards,
Jurko Gospodnetić
When using py lib in python3 environment it is natural for using open method with encoding parameter
http://pylib.readthedocs.org/en/latest/path.html#py-path-local-local-file-system-path
Calling ansi_print with a large string can fail on Windows, if the output goes to the console.
This issue is similar to CPython [[http://bugs.python.org/issue11395|issue 11395]], and happens when the file is opened in binary mode.
The fix is to write data in small chunks. Unfortunately the buffer size is unknown and the limit seems to depend on memory usag. 32768 seems to pass in all cases.
I implemented the fix in pypy: [[https://bitbucket.org/pypy/pypy/changeset/6a4033a99b58| 6a4033a99b58]]
and seems to hang in troublesome ways on big files
I encountered the error when running pytest on a project in Python 3. I'm using pytest 2.3.5 and py 1.4.15. The distilled error is apparent here:
>>> sorted(['foo', py.path.local()])
[local('C:\\Users\\jaraco\\G\\pan'), 'foo']
>>> sorted([py.path.local(), 'foo'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: str() < LocalPath()
I observed that LocalPath doesn't implement __gt__
:
>>> py.path.local.__gt__
<slot wrapper '__gt__' of 'object' objects>
I was able to simply monkey-patch LocalPath to work around the error:
>>> py.path.local.__gt__ = lambda self, other: not (self < other or self == other)
>>> sorted([py.path.local(), 'foo'])
[local('C:\\Users\\jaraco\\G\\pan'), 'foo']
For pythons 2.7 3.2 3.3;
py-1.4.19 $ PYTHONPATH=build/lib py.test testing/
== test session starts ==
plugins: cov
collected 841 items
testing/path/test_svnwc.py ........................................................................x....................F............
==== FAILURES ====
____ TestWCSvnCommandPath.test_lock_unlock ___
self = <test_svnwc.TestWCSvnCommandPath object at 0x7fee850c5f90>, path1 = svnwc('/tmp/pytest-7/test_make_repo0/path1wc')
def test_lock_unlock(self, path1):
root = path1
somefile = root.join('somefile')
somefile.ensure(file=True)
# not yet added to repo
py.test.raises((py.process.cmdexec.Error, ValueError), 'somefile.lock()')
/mnt/gen2/TmpDir/portage/dev-python/py-1.4.19/work/py-1.4.19/testing/path/test_svnwc.py:341:
somefile.lock()
<75-codegen /usr/lib64/python3.3/site-packages/_pytest/python.py:905>:1:
self = svnwc('/tmp/pytest-7/test_make_repo0/path1wc/somefile')
def lock(self):
""" set a lock (exclusive) on the resource """
out = self._authsvn('lock').strip()
/mnt/gen2/TmpDir/portage/dev-python/py-1.4.19/work/py-1.4.19/build/lib/py/_path/svnwc.py:596:
self = svnwc('/tmp/pytest-7/test_make_repo0/path1wc/somefile'), cmd = 'lock', args = ['']
def _authsvn(self, cmd, args=None):
args = args and list(args) or []
args.append(self._makeauthoptions())
return self._svn(cmd, *args)
/mnt/gen2/TmpDir/portage/dev-python/py-1.4.19/work/py-1.4.19/build/lib/py/_path/svnwc.py:462:
self = svnwc('/tmp/pytest-7/test_make_repo0/path1wc/somefile'), cmd = 'lock', args = ['']
l = ['svn lock', '', '"/tmp/pytest-7/test_make_repo0/path1wc/somefile"']
string = 'LC_ALL=C svn lock "/tmp/pytest-7/test_make_repo0/path1wc/somefile"', key = 'LC_MESSAGES'
def _svn(self, cmd, *args):
l = ['svn %s' % cmd]
args = [self._escape(item) for item in args]
l.extend(args)
l.append('"%s"' % self._escape(self.strpath))
# try fixing the locale because we can't otherwise parse
string = fixlocale() + " ".join(l)
try:
try:
key = 'LC_MESSAGES'
hold = os.environ.get(key)
os.environ[key] = 'C'
out = py.process.cmdexec(string)
finally:
if hold:
os.environ[key] = hold
else:
del os.environ[key]
except py.process.cmdexec.Error:
e = sys.exc_info()[1]
strerr = e.err.lower()
if strerr.find('not found') != -1:
raise py.error.ENOENT(self)
E py.error.ENOENT: [No such file or directory]: /tmp/pytest-7/test_make_repo0/path1wc/somefile
/mnt/gen2/TmpDir/portage/dev-python/py-1.4.19/work/py-1.4.19/build/lib/py/_path/svnwc.py:486: ENOENT
========================================================= short test summary info =========================================================
XFAIL testing/code/test_source.py::TestSourceParsingAndCompiling::()::test_getstatementrange_bug2
XFAIL testing/path/test_local.py::TestLocalPath::()::test_long_filenames
reason: [NOTRUN] unreliable est for long filenames
XFAIL testing/path/test_local.py::TestUnicodePy2Py3::()::test_read_write
changing read/write might break existing usages
XFAIL testing/path/test_svnurl.py::TestSvnURLCommandPath::()::test_load
XFAIL testing/path/test_svnwc.py::TestWCSvnCommandPath::()::test_status_update
svn-1.7 has buggy 'status --xml' output
FAIL testing/path/test_svnwc.py::TestWCSvnCommandPath::()::test_lock_unlock
====================================== 1 failed, 810 passed, 25 skipped, 5 xfailed in 25.09 seconds =======================================
however
py-1.4.19 $ ls -ld /tmp/pytest-5/test_make_repo0/path1wc/somefile
-rw-r--r-- 1 testuser testuser 0 Jan 29 15:06 /tmp/pytest-5/test_make_repo0/path1wc/somefile
see pygments terminal and terminal256 for-matters
https://bitbucket.org/hpk42/py/src/980c8d526463/py/_io/saferepr.py#cl-29
#!
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/main.py", line 81, in wrap_session
INTERNALERROR> doit(config, session)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/main.py", line 113, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 422, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 433, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 351, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/main.py", line 133, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 422, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 433, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 351, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/runner.py", line 62, in pytest_runtest_protocol
INTERNALERROR> runtestprotocol(item, nextitem=nextitem)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/runner.py", line 69, in runtestprotocol
INTERNALERROR> reports.append(call_and_report(item, "call", log))
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/runner.py", line 100, in call_and_report
INTERNALERROR> report = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/main.py", line 157, in call_matching_hooks
INTERNALERROR> return hookmethod.pcall(plugins, **kwargs)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 426, in pcall
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 433, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 351, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/capture.py", line 171, in pytest_runtest_makereport
INTERNALERROR> rep = __multicall__.execute()
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 351, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/runner.py", line 191, in pytest_runtest_makereport
INTERNALERROR> longrepr = item.repr_failure(excinfo)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/python.py", line 481, in repr_failure
INTERNALERROR> style=self.config.option.tbstyle)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/python.py", line 476, in _repr_failure_py
INTERNALERROR> style=style)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/_pytest/main.py", line 340, in _repr_failure_py
INTERNALERROR> style=style)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/py/_code/code.py", line 392, in getrepr
INTERNALERROR> return fmt.repr_excinfo(self)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/py/_code/code.py", line 569, in repr_excinfo
INTERNALERROR> reprtraceback = self.repr_traceback(excinfo)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/py/_code/code.py", line 561, in repr_traceback
INTERNALERROR> reprentry = self.repr_traceback_entry(entry, einfo)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/py/_code/code.py", line 522, in repr_traceback_entry
INTERNALERROR> reprargs = self.repr_args(entry)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/py/_code/code.py", line 447, in repr_args
INTERNALERROR> args.append((argname, self._saferepr(argvalue)))
INTERNALERROR> File "/usr/lib/python2.7/site-packages/py/_code/code.py", line 441, in _saferepr
INTERNALERROR> return py.io.saferepr(obj)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/py/_io/saferepr.py", line 54, in saferepr
INTERNALERROR> return srepr.repr(obj)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/py/_io/saferepr.py", line 13, in repr
INTERNALERROR> return self._callhelper(reprlib.Repr.repr, self, x)
INTERNALERROR> File "/usr/lib/python2.7/site-packages/py/_io/saferepr.py", line 29, in _callhelper
INTERNALERROR> except sysex:
INTERNALERROR> NameError: global name 'sysex' is not defined
When running the tests for py 1.4.7 or trunk (running py.test) with pypy 1.8 the following happens:
This is arguably mostly a pypy bug (why is its pickle looking at sys.modules at all, and why is it not coping with dict access failing?) but it can be worked around in the pylib testsuite by adding a try/finally: del sys.modules['errorloading1'] to test_apikpg.test_error_loading_one_element. This seems tidier (why keep the module that's specific to this test around in sys.modules?). I'll spare you the patch as I suspect there's some pypy-specific thing for this I don't know about, and it's obvious otherwise.
py._code.source.Source.getstatementrange() sometimes might raise "UnboundLocalError: local variable 'end' referenced before assignment". I use py 1.4.5.
>>> import py._code.source
>>> source = py._code.source.Source(":")
>>> source.getstatementrange(0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.2/site-packages/py/_code/source.py", line 142, in getstatementrange
return start, end
UnboundLocalError: local variable 'end' referenced before assignment
If py is installed but py.test is not, I would expect "import py.test" to raise ImportError. Instead, what happens if that it raises the first time I try to access an attribute:
>>> import py.test
>>> py.test.foo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/foobar/lib/python2.7/site-packages/py/_apipkg.py", line 159, in __getattribute__
return getattr(getmod(), name)
File "/tmp/foobar/lib/python2.7/site-packages/py/_apipkg.py", line 144, in getmod
x = importobj(modpath, None)
File "/tmp/foobar/lib/python2.7/site-packages/py/_apipkg.py", line 37, in importobj
module = __import__(modpath, None, None, ['__doc__'])
ImportError: No module named pytest
wich causes multi-second hangs in testsuites
py.process.ForkedFunc
is explicitly skipping exit handlers by calling os._exit
. This breaks coverage's subprocess capturing.
Running the attached script reports the child line as missing because the coverage file of the child process is never saved to disk.
$ coverage run -p pyfork.py
2
$ coverage combine
$ coverage report -m
Name Stmts Miss Cover Missing
--------------------------------------
pyfork 9 1 89% 6
cc @ned
I get the error:
INTERNALERROR> File "/home/travis/virtualenv/python3.2/lib/python3.2/site-packages/py/_io/capture.py", line 107, in dupfile
INTERNALERROR> mode = mode and mode or f.mode
INTERNALERROR> AttributeError: '_io.TextIOWrapper' object has no attribute 'mode'
when trying to use py.test on python 3.2, FileIO has a mode attribute but TetxIOWrapper does not.
I'm getting on Travis Python 3:
sys.stdout = stdout = open(str(self.STDOUT), "w", 0)
ValueError: can't have unbuffered text I/O
This is with pull request #15 applied but my changes should be unrelated.
The CHANGELOG doesn't have info about py 1.4.19 yet.
http://pylib.readthedocs.org/en/latest/changelog.html#changelog
Though the CHANGELOG in Bitbucket already has it, so I think it's just a matter of pushing out an update.
First I launched pytest on my unicode python project, it failed on junitxml.py file from pytest. Then I found fix for this issue:
https://bitbucket.org/apkawa/pytest/commits/1a284b99104e2d525b46a13a0fffff081158377a
Now it fails with the following message:
File "C:\Python27\lib\site-packages\py_xmlgen.py", line 133, in __object
self.write(escape(unicode(obj)))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 1305: ordinal not in range(128)
Some tests fail with Jython. I use py 1.4.6, pytest 2.2.1 and Jython 2.5.1. I'm attaching the log of tests. All tests pass with CPython.
The version of pylib used in pypy raises an exception in py._path.local.exists(r'd:\slave') on windows if d: is a cdrom and no cdrom is in the drive. This came up on a buildbot, the log is here http://buildbot.pypy.org/builders/pypy-c-jit-win-x86-32/builds/440/steps/translate/logs/stdio
All tests in test_forkedfunc.py are failing here, with the released tarball downloaded from PyPI.
Below I've pasted the whole test output with Python 3.4.1/2.7.8.
============================= test session starts ==============================
platform linux -- Python 3.4.1 -- py-1.4.20 -- pytest-2.5.2
collected 845 items
testing/test_iniconfig.py ...........................................
testing/code/test_assertion.py .................ss.......
testing/code/test_code.py ............
testing/code/test_excinfo.py ..........s.........s..........F..F...................................F
testing/code/test_source.py .......................x.......................................
testing/io_/test_capture.py .........s........s.............s.............s...........s....s...........s.........
testing/io_/test_saferepr.py ........
testing/io_/test_terminalwriter.py ...........................................
testing/log/test_log.py .................
testing/log/test_warning.py ......
testing/path/test_cacheutil.py .............
testing/path/test_local.py .........................................................................................x....s.............................ssssss..........................x
testing/path/test_svnauth.py ......ssss..............sssssssssss
testing/path/test_svnurl.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss....
testing/path/test_svnwc.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.ss..sssss
testing/process/test_cmdexec.py .....
testing/process/test_forkedfunc.py EEEEEEEEEEEEEE
testing/process/test_killproc.py .
testing/root/test_builtin.py ...................
testing/root/test_error.py .....
testing/root/test_py_imports.py ................
testing/root/test_std.py ...
testing/root/test_xmlgen.py ...................
==================================== ERRORS ====================================
______________ ERROR at setup of test_waitfinish_removes_tempdir _______________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d372e8>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
_______________ ERROR at setup of test_tempdir_gets_gc_collected _______________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33db0cc0>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
___________________ ERROR at setup of test_basic_forkedfunc ____________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d37ac8>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
______________________ ERROR at setup of test_exitstatus _______________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d59358>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
___________________ ERROR at setup of test_execption_in_func ___________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33db0cf8>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
___________________ ERROR at setup of test_forkedfunc_on_fds ___________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d5c3c8>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
_______________ ERROR at setup of test_forkedfunc_on_fds_output ________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d37780>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
_________________ ERROR at setup of test_forkedfunc_on_stdout __________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d42748>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
___________________ ERROR at setup of test_forkedfunc_signal ___________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d59400>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
_________________ ERROR at setup of test_forkedfunc_huge_data __________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d622b0>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
________________________ ERROR at setup of test_box_seq ________________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d5a748>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
_____________________ ERROR at setup of test_box_in_a_box ______________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d654e0>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
___________________ ERROR at setup of test_kill_func_forked ____________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d37e48>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
_________________________ ERROR at setup of test_hooks _________________________
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d33d66518>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21/testing/process/test_forkedfunc.py:8: AttributeError
=================================== FAILURES ===================================
_____________ TestFormattedExcinfo.test_repr_tracebackentry_short ______________
self = <test_excinfo.TestFormattedExcinfo object at 0x7f7d3448c5c0>
importasmod = <function TestFormattedExcinfo.pytest_funcarg__importasmod.<locals>.importasmod at 0x7f7d347c5378>
def test_repr_tracebackentry_short(self, importasmod):
mod = importasmod("""
def func1():
raise ValueError("hello")
def entry():
func1()
""")
excinfo = py.test.raises(ValueError, mod.entry)
p = FormattedExcinfo(style="short")
reprtb = p.repr_traceback_entry(excinfo.traceback[-2])
lines = reprtb.lines
basename = py.path.local(mod.__file__).basename
> assert lines[0] == ' func1()'
E assert '> func1()' == ' func1()'
E - > func1()
E ? ----
E + func1()
testing/code/test_excinfo.py:550: AssertionError
_____________ TestFormattedExcinfo.test_traceback_short_no_source ______________
self = <test_excinfo.TestFormattedExcinfo object at 0x7f7d343d99e8>
importasmod = <function TestFormattedExcinfo.pytest_funcarg__importasmod.<locals>.importasmod at 0x7f7d345b1d90>
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f7d343d9a20>
def test_traceback_short_no_source(self, importasmod, monkeypatch):
mod = importasmod("""
def func1():
raise ValueError("hello")
def entry():
func1()
""")
excinfo = py.test.raises(ValueError, mod.entry)
from py._code.code import Code
monkeypatch.setattr(Code, 'path', 'bogus')
excinfo.traceback[0].frame.code.path = "bogus"
p = FormattedExcinfo(style="short")
reprtb = p.repr_traceback_entry(excinfo.traceback[-2])
lines = reprtb.lines
last_p = FormattedExcinfo(style="short")
last_reprtb = last_p.repr_traceback_entry(excinfo.traceback[-1], excinfo)
last_lines = last_reprtb.lines
monkeypatch.undo()
basename = py.path.local(mod.__file__).basename
> assert lines[0] == ' func1()'
E assert '> func1()' == ' func1()'
E - > func1()
E ? ----
E + func1()
testing/code/test_excinfo.py:614: AssertionError
________________ TestFormattedExcinfo.test_traceback_repr_style ________________
self = <test_excinfo.TestFormattedExcinfo object at 0x7f7d34667e80>
importasmod = <function TestFormattedExcinfo.pytest_funcarg__importasmod.<locals>.importasmod at 0x7f7d347c5bf8>
def test_traceback_repr_style(self, importasmod):
mod = importasmod("""
def f():
g()
def g():
h()
def h():
i()
def i():
raise ValueError()
""")
excinfo = py.test.raises(ValueError, mod.f)
excinfo.traceback = excinfo.traceback.filter()
> excinfo.traceback[1].set_repr_style("short")
E AttributeError: 'TracebackEntry' object has no attribute 'set_repr_style'
testing/code/test_excinfo.py:836: AttributeError
=========================== short test summary info ============================
XFAIL testing/code/test_source.py::TestSourceParsingAndCompiling::()::test_getstatementrange_bug2
XFAIL testing/path/test_local.py::TestLocalPath::()::test_long_filenames
reason: [NOTRUN] unreliable est for long filenames
XFAIL testing/path/test_local.py::TestUnicodePy2Py3::()::test_read_write
changing read/write might break existing usages
FAIL testing/code/test_excinfo.py::TestFormattedExcinfo::()::test_repr_tracebackentry_short
FAIL testing/code/test_excinfo.py::TestFormattedExcinfo::()::test_traceback_short_no_source
FAIL testing/code/test_excinfo.py::TestFormattedExcinfo::()::test_traceback_repr_style
=== 3 failed, 615 passed, 210 skipped, 3 xfailed, 14 error in 10.10 seconds ====
============================= test session starts ==============================
platform linux2 -- Python 2.7.8 -- py-1.4.20 -- pytest-2.5.2
collected 845 items
testing/test_iniconfig.py ...........................................
testing/code/test_assertion.py .................ss.......
testing/code/test_code.py ............
testing/code/test_excinfo.py ..........s.........s..........F..F...................................F
testing/code/test_source.py .......................x.......................................
testing/io_/test_capture.py .........s................................................s................s.........
testing/io_/test_saferepr.py ........
testing/io_/test_terminalwriter.py ...........................................
testing/log/test_log.py .................
testing/log/test_warning.py ......
testing/path/test_cacheutil.py .............
testing/path/test_local.py .........................................................................................x....s.............................ssssss..........................x
testing/path/test_svnauth.py ......ssss..............sssssssssss
testing/path/test_svnurl.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss....
testing/path/test_svnwc.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.ss..sssss
testing/process/test_cmdexec.py .....
testing/process/test_forkedfunc.py EEEEEEEEEEEEEE
testing/process/test_killproc.py .
testing/root/test_builtin.py ...................
testing/root/test_error.py .....
testing/root/test_py_imports.py ................
testing/root/test_std.py ...
testing/root/test_xmlgen.py ...................
==================================== ERRORS ====================================
______________ ERROR at setup of test_waitfinish_removes_tempdir _______________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e4234368>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
_______________ ERROR at setup of test_tempdir_gets_gc_collected _______________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e3e2f320>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
___________________ ERROR at setup of test_basic_forkedfunc ____________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e40f5560>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
______________________ ERROR at setup of test_exitstatus _______________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e40f4cb0>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
___________________ ERROR at setup of test_execption_in_func ___________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e40f3908>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
___________________ ERROR at setup of test_forkedfunc_on_fds ___________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e40ed9e0>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
_______________ ERROR at setup of test_forkedfunc_on_fds_output ________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e40ef830>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
_________________ ERROR at setup of test_forkedfunc_on_stdout __________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e4277cb0>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
___________________ ERROR at setup of test_forkedfunc_signal ___________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e48db200>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
_________________ ERROR at setup of test_forkedfunc_huge_data __________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e4e68a28>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
________________________ ERROR at setup of test_box_seq ________________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e4117d88>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
_____________________ ERROR at setup of test_box_in_a_box ______________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e40f5b48>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
___________________ ERROR at setup of test_kill_func_forked ____________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e3fe28c0>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
_________________________ ERROR at setup of test_hooks _________________________
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e3fed3b0>
@pytest.fixture(autouse=True)
def clear_forkedfunc(monkeypatch):
> monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
E AttributeError: <class 'py._process.forkedfunc.ForkedFunc'> has no attribute '_on_start'
/build/python-py/src/py-1.4.21-py2/testing/process/test_forkedfunc.py:8: AttributeError
=================================== FAILURES ===================================
_____________ TestFormattedExcinfo.test_repr_tracebackentry_short ______________
self = <test_excinfo.TestFormattedExcinfo instance at 0x7f04e44ad710>
importasmod = <function importasmod at 0x7f04e4919f50>
def test_repr_tracebackentry_short(self, importasmod):
mod = importasmod("""
def func1():
raise ValueError("hello")
def entry():
func1()
""")
excinfo = py.test.raises(ValueError, mod.entry)
p = FormattedExcinfo(style="short")
reprtb = p.repr_traceback_entry(excinfo.traceback[-2])
lines = reprtb.lines
basename = py.path.local(mod.__file__).basename
> assert lines[0] == ' func1()'
E assert '> func1()' == ' func1()'
E - > func1()
E ? ----
E + func1()
testing/code/test_excinfo.py:550: AssertionError
_____________ TestFormattedExcinfo.test_traceback_short_no_source ______________
self = <test_excinfo.TestFormattedExcinfo instance at 0x7f04e420d7a0>
importasmod = <function importasmod at 0x7f04e436ac80>
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f04e420d878>
def test_traceback_short_no_source(self, importasmod, monkeypatch):
mod = importasmod("""
def func1():
raise ValueError("hello")
def entry():
func1()
""")
excinfo = py.test.raises(ValueError, mod.entry)
from py._code.code import Code
monkeypatch.setattr(Code, 'path', 'bogus')
excinfo.traceback[0].frame.code.path = "bogus"
p = FormattedExcinfo(style="short")
reprtb = p.repr_traceback_entry(excinfo.traceback[-2])
lines = reprtb.lines
last_p = FormattedExcinfo(style="short")
last_reprtb = last_p.repr_traceback_entry(excinfo.traceback[-1], excinfo)
last_lines = last_reprtb.lines
monkeypatch.undo()
basename = py.path.local(mod.__file__).basename
> assert lines[0] == ' func1()'
E assert '> func1()' == ' func1()'
E - > func1()
E ? ----
E + func1()
testing/code/test_excinfo.py:614: AssertionError
________________ TestFormattedExcinfo.test_traceback_repr_style ________________
self = <test_excinfo.TestFormattedExcinfo instance at 0x7f04e41ce440>
importasmod = <function importasmod at 0x7f04e407eaa0>
def test_traceback_repr_style(self, importasmod):
mod = importasmod("""
def f():
g()
def g():
h()
def h():
i()
def i():
raise ValueError()
""")
excinfo = py.test.raises(ValueError, mod.f)
excinfo.traceback = excinfo.traceback.filter()
> excinfo.traceback[1].set_repr_style("short")
E AttributeError: 'TracebackEntry' object has no attribute 'set_repr_style'
testing/code/test_excinfo.py:836: AttributeError
=========================== short test summary info ============================
XFAIL testing/code/test_source.py::TestSourceParsingAndCompiling::()::test_getstatementrange_bug2
XFAIL testing/path/test_local.py::TestLocalPath::()::test_long_filenames
reason: [NOTRUN] unreliable est for long filenames
XFAIL testing/path/test_local.py::TestUnicodePy2Py3::()::test_read_write
changing read/write might break existing usages
FAIL testing/code/test_excinfo.py::TestFormattedExcinfo::()::test_repr_tracebackentry_short
FAIL testing/code/test_excinfo.py::TestFormattedExcinfo::()::test_traceback_short_no_source
FAIL testing/code/test_excinfo.py::TestFormattedExcinfo::()::test_traceback_repr_style
==== 3 failed, 619 passed, 206 skipped, 3 xfailed, 14 error in 5.82 seconds ====
py.path.local.sysfind tries several extensions on Windows: .exe, .bat, .com. But Mercurial installs a "hg.cmd" script.
So even when the "hg" command works from the command prompt, py.path.local.sysfind('hg') won't find the program.
I suggest to either add the .cmd extension (it's an old remnant of the OS/2 times, but today there is no difference at all between .cmd and .bat), or use the PATHEXT environment variable, which "determines which extensions to look for and in what order" (see "help start")
Since sending errors through network in client-server apps is very common, this confuses me a little ;).
#!python
import py
import pickle
pickle.dumps(py.error.ENOENT())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/pickle.py", line 1366, in dumps
Pickler(file, protocol).dump(obj)
File "/usr/lib/python2.6/pickle.py", line 224, in dump
self.save(obj)
File "/usr/lib/python2.6/pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python2.6/pickle.py", line 400, in save_reduce
save(func)
File "/usr/lib/python2.6/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python2.6/pickle.py", line 748, in save_global
(obj, module, name))
pickle.PicklingError: Can't pickle <class 'py.error.ENOENT'>: it's not found as py.error.ENOENT
I found this out while writing test cases using py.test:
def break_next_test(tmpdir):
subdir = tempdir.ensure("will_be_removed",dir=True)
subdir.chdir()
subdir.remove(rec=1, ignore_errors=1)
assert not subdir.check()
def next_test(tmpdir):
subdir = tmpdir.ensure("some_other_dir', dir=True)
subdir.chdir() # <--- This breaks with an IOError that traces back to _path/local saying that os.getcwd() doesn't exist.
py 1.4.13 introduced 1 test failure with Python 3.1 in test_comment_and_no_newline_at_end() in testing/code/test_source.py. I attach the patch. It is related to 23989858118c7b70ecd6665c8e0df127d2c5e21a and 46000904e4e3ba0507439366c0c12d19d1d1cefb.
The heading at https://pylib.readthedocs.org/en/1.4.3/path.html#py-test-local-local-file-system-path mentions py.test.local where it should be py.path.local
Hopefully the following repl session should explain the problem clearly; it originates from tox not being able to find the python2.6
I had on my path. The codepath demonstrated is basically some relevant parts of py.path.local.sysfind
.
I've had ~/bin
on my path for the better part of a year and nothing else has been unexpectedly broken from it.
Python 2.7.6 (default, Feb 26 2014, 12:07:17)
[GCC 4.8.2 20140206 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import py
>>> paths = py.std.os.environ['PATH'].split(':')
>>> paths
['/home/ivo/.virtualenvs/pypa/pip/bin', '~/bin', '/home/ivo/.rbenv/shims', '/home/ivo/.rbenv/bin', '/usr/local/sbin', '/usr/local/bin', '/usr/bin', '/opt/android-sdk/platform-tools', '/usr/bin/core_perl', '/home/ivo/.gem/ruby/2.0.0/bin', '/home/ivo/code/go/bin']
>>> paths[1]
'~/bin'
>>> py.path.local(paths[1])
local('/home/ivo/code/pypa/pip/~/bin')
>>>
This bug occurs when running on windows, and the pattern has one or more posix path separators.
On windows, do the following
mkvirtualenv winpathbug
pip install pytest mock
git checkout https://bitbucket.org/zzzeek/sqlalchemy.git
py.test --collect-only -q
py.test finds no tests
============ test session starts ============
platform win32 -- Python 2.7.5 -- py-1.4.22 -- pytest-2.6.0
collected 0 items
============ in 0.90 seconds ============
Now, change setup.cfg
[pytest]
addopts= --tb native -v -r fxX
-python_files=test/*test_*.py
+python_files=test\\*test_*.py
Run py.test again
py.test --collect-only -q
With the windows-style path in setup.cfg, py.test now finds all the tests
============ test session starts ============
platform win32 -- Python 2.7.5 -- py-1.4.22 -- pytest-2.6.0
collected 6576 items
<Module 'test/aaa_profiling/test_compiler.py'>
<Class 'CompileTest_sqlite_pysqlite'>
<Instance '()'>
<Function 'test_insert'>
<Function 'test_select'>
. . .
<Function 'test_where_empty'>
============ in 8.39 seconds ============
I have written a bug fix with a test.
The pull request changes common.FNMatcher so that it will match patterns containing posix path separators even on windows.
bug in source code parsing, see
https://bitbucket.org/hpk42/pytest/issue/560/indexerror-in-source-display
When having ";;" in setup.cfg or tox.ini files iniconfig bails out with e.g.:
py._iniconfig.ParseError: /Users/hpk/p/pytest-xdist/tox.ini:24: unexpected line: ';; hello'
It should
Detected while running tests using py.test using its --genscript'ed script. See https://travis-ci.org/psychopy/psychopy/builds/7805746#L1759 for the traceback
While reconstructing details of the traceback, those originally existed (in a temporary directory) files (e.g. py._code/bisect.py and _pytest.runner ) are no longer available, which causes abspath to spit out OSError and thus py.test simply exits with error code 3 without spitting out any traceback
while taking a look how to deal with encodings,
i came across a lot of code paths, that cant be fixed in a correct way without breaking the api
in particular insane hacks that drop the defaultencoding in
When running the example file test_test.py with py.test, the current version of py does not show * and ** arguments (see before.out).
The attached patch adds getvarargs() and getvarkwds() methods to both py.code.Code and py.code.Frame. py.code.FormattedExcinfo.repr_args() is modified to include information about variable arguments if they are present (see after.out).
There's a bug which was introduced in py 1.4.5 which was affecting pytests which prints characters outside of expected text encodings.
There are some tests which deal with handling text encoded in different ways - some of that text gets printed out to stdout and py 1.4.5 isn't able to handle the text in the way that it could in 1.4.4.
Here's a paste of the error that I get:
http://a.libpa.st/s9TUK
I've also attached a test which reproduces the problem.
test_assert_within_finally() fails with CPython 3.3. This test passes with older versions of CPython. Other tests pass with CPython 3.3. I use py 1.4.6 and pytest 2.2.1.
============================= test session starts ==============================
platform linux -- Python 3.3.0 -- pytest-2.2.1
collected 816 items
testing/test_apipkg.py ...............................
testing/test_iniconfig.py ........................................
testing/code/test_assertion.py ..F..............ss.......
testing/code/test_code.py ...........
testing/code/test_excinfo.py ..........s........s...............................................
testing/code/test_source.py .......................x........................
testing/io_/test_capture.py ................................................................................
testing/io_/test_saferepr.py ........
testing/io_/test_terminalwriter.py ....................................
testing/log/test_log.py .................
testing/log/test_warning.py ......
testing/path/test_cacheutil.py .............
testing/path/test_local.py ................................................................................x.s...........................ssssss.....................
testing/path/test_svnauth.py ........................sssssssssss
testing/path/test_svnurl.py .............................................................x...............
testing/path/test_svnwc.py .......................................................................x.................................
testing/process/test_cmdexec.py .....
testing/process/test_forkedfunc.py ...........
testing/process/test_killproc.py .
testing/root/test_builtin.py .................
testing/root/test_error.py .....
testing/root/test_py_imports.py ................
testing/root/test_sources.py ....
testing/root/test_std.py ...
testing/root/test_xmlgen.py .................
=================================== FAILURES ===================================
__________________________ test_assert_within_finally __________________________
def test_assert_within_finally():
class A:
def f():
pass
excinfo = py.test.raises(TypeError, """
try:
A().f()
finally:
i = 42
""")
s = excinfo.exconly()
> assert s.find("takes no argument") != -1
E assert -1 != -1
E + where -1 = <built-in method find of str object at 0x7f68084bf6c0>('takes no argument')
E + where <built-in method find of str object at 0x7f68084bf6c0> = 'TypeError: f() takes 0 positional arguments but 1 was given'.find
testing/code/test_assertion.py:35: AssertionError
========= 1 failed, 789 passed, 22 skipped, 4 xfailed in 63.23 seconds =========
Per title, 'pip install argparse' is enough to cure it. Missing dep?
At least LocalPath docs have the methods in seemingly random order. It's not alphabetical, but also not by theme (for example write and read are not next to each other, or even on the same page).
A pure alphabetical sort would be better. Perhaps even better would be to first group them by their respective stdlib packages (like functions similar to os in one place, others similar to file objects in another).
The docs say that read() should return a bytestring, but on Python3 it returns an unicode string. This breaks up Python3 builtins that expect a buffer interface. The read() does have a mode parameter, but this doesn't help when passing LocalPaths into library functions expecting normal builtin file objects.
A workaround is to use LocalPath.open('rb').
Is there any reason why py.path.local.move returns None instead of the new path?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.