Commit Graph

264 Commits

Author SHA1 Message Date
holger krekel 4f7ef0b63f fix issue89 - allow py.test.mark decorators to be used with classes
(if you are using >=python2.6)
also allow to have multiple markers applied at class level
and test and fix a bug with chained skip/xfail decorators:
if any of the conditions is true a test will be skipped/xfailed
with a explanation which condition evaluated to true.

--HG--
branch : trunk
2010-05-21 18:11:47 +02:00
holger krekel 578cba20d4 fix issue94 make reporting more robust against bogus source code
(and internally be more careful when presenting unexpected byte sequences)
also make py.code.Source accept a list of lines directly.

--HG--
branch : trunk
2010-05-21 16:42:46 +02:00
holger krekel 93f91c9607 unify handling of reportcharacters across resultlog/junitxml plugins
--HG--
branch : trunk
2010-05-20 14:35:13 +02:00
holger krekel 925f75088d fix issue91 introduce new py.test.xfail(reason) helper
to imperatively mark a test as expected to fail. Can
be used from within setup and test functions. This is
useful especially for parametrized tests when certain
configurations are expected-to-fail.  In this case the
declarative approach with the @py.test.mark.xfail cannot
be used as it would mark all configurations as xfail.

--HG--
branch : trunk
2010-05-20 13:29:51 +02:00
holger krekel eac0345689 fix wrong test invocation
--HG--
branch : trunk
2010-05-19 17:05:13 +02:00
holger krekel 20424a9c76 fix and test "-rP" option to show xpass-test ids
--HG--
branch : trunk
2010-05-19 16:52:03 +02:00
holger krekel 2229d2d947 revert 1735 - fix issue95 differently: just shift the offending zlib
import (and others) to happen when they are actually needed

--HG--
branch : trunk
2010-05-19 16:42:22 +02:00
holger krekel c3bd29b490 fix issue95 - treat a failing pytest_genscript import
as non-critical, give a hint.

--HG--
branch : trunk
2010-05-19 16:22:23 +02:00
holger krekel cf255cd643 some special handling of stdin capturing, unification, un-xfail the win32 test
--HG--
branch : trunk
2010-05-18 12:12:34 -07:00
holger krekel 10296faff1 for now don't test close(0) on windows - it hangs there
--HG--
branch : trunk
2010-05-18 11:43:22 -07:00
holger krekel 9f5e6f9761 simplify and unify FDCapture API and usage:
* FDCapture now takes care through the 'patchsys' option to
  also set sys.stdin/out/err - setfiles/unsetfiles methods removed -
  i doubt anybody uses this outside of py.test's own old usage.
* stdin also goes through FDCapture now.

--HG--
branch : trunk
2010-05-18 20:03:44 +02:00
holger krekel da097c9d67 deal gracefully with invalid file descriptors - don't capture the particular stream
--HG--
branch : trunk
2010-05-18 16:52:56 +02:00
holger krekel 4f5d7948f7 - try to fix the nightly failures by refining internal capturing mechanism
and adding tests, including a "lsof" test for making sure the number of
  open file descriptors does not increase.
- also move a py.io related logging test to testing/io

--HG--
branch : trunk
2010-05-18 16:01:58 +02:00
holger krekel 1a97c59439 fix test to account for earlier capfd skipping (on jython)
--HG--
branch : trunk
2010-05-18 09:54:04 +02:00
holger krekel e71685736e fix issue96 - make capturing more resilient against KeyboardInterrupt
--HG--
branch : trunk
2010-05-17 19:00:39 +02:00
holger krekel f97e082543 fix test to work on jython and cpy
--HG--
branch : trunk
2010-05-14 15:25:24 +02:00
holger krekel 91880ffc19 adding three x-failing tests for issue88, issue93 and related issues
--HG--
branch : trunk
2010-05-14 12:02:43 +02:00
holger krekel 169d8d1e54 fix test to account for jython python file ending
--HG--
branch : trunk
2010-05-12 14:12:07 +02:00
holger krekel 379390a8aa remove code.new() function and store lines directly into linecache.cache instead.
This avoids the need for custom code objects, improving compatibility for jython
and pypy-c.

--HG--
branch : trunk
2010-05-11 22:54:04 +02:00
holger krekel 8ba2a98e11 allow to run py.test.cmdline.main() multiple times.
--HG--
branch : trunk
2010-05-11 19:56:22 +02:00
holger krekel ee036223ce deprecate --report option in favour of a new shorter and easier to remember -r option: this takes a string argument consisting of any combination of 'xsfX'
Those letters basically correspond to the letters you see during terminal reporting.

--HG--
branch : trunk
2010-05-05 19:50:59 +02:00
holger krekel c933ada7fb new --runxfail option to ignore xfail markers on functions
--HG--
branch : trunk
2010-05-04 13:02:27 +02:00
holger krekel 28150c7486 add unit-tests for xfail and refine xfail handling and reporting
--HG--
branch : trunk
2010-05-04 12:37:56 +02:00
holger krekel dd7fd97810 add a terminalreporter.testid method
--HG--
branch : trunk
2010-05-04 12:37:52 +02:00
holger krekel 1a8b2838fa add new parameters:
xfail(run=False) will not run expected-to-fail tests
xfail(reason=True) will report the specified reason

--HG--
branch : trunk
2010-05-02 22:13:16 +02:00
holger krekel 82d4aae571 some internal fixes regarding the new required hook-finding prefix
--HG--
branch : trunk
2010-05-02 17:10:38 +02:00
holger krekel fd473d4002 refine and test new hook registration, now it is called "pytest_addhooks"
similar to pytest_addoption and raises on bogus input.

--HG--
branch : trunk
2010-05-02 16:36:53 +02:00
holger krekel 45e10f4c48 rename pytest_ignore_collect_path to pytest_ignore_collect before release
--HG--
branch : trunk
2010-05-02 15:24:02 +02:00
Ronny Pfannschmidt b3ce06bbf9 add close method to DontReadFromInput so multiprocessing can close it
--HG--
branch : trunk
2010-04-29 19:46:43 +02:00
holger krekel 962d0fe2be introduce new pytest_pycollect_makemodule(path, parent) hook for
allowing customization of the Module collection object for a matching test module.

--HG--
branch : trunk
2010-04-29 16:53:29 +02:00
holger krekel 811408959f introduce a new pytest_ignore_collect_path(path, config) hook -
returning a true value will prevent considering the path for collection
The hook is called for both files and directory paths.

--HG--
branch : trunk
2010-04-29 16:20:55 +02:00
holger krekel 5ece3858e4 introduce new py.io.saferepr for printing the 'repr' of an object safely
and without consuming too much space

--HG--
branch : trunk
2010-04-29 14:17:07 +02:00
holger krekel 1c1623885f fix a py3k related skip - py.io.TextIO on py3k should probably
not allow to write bytes to it.

--HG--
branch : trunk
2010-04-29 10:50:20 +02:00
holger krekel 5dc66bb4ca make py.io.ansi_print and py.io.get_terminal_width() directly available.
--HG--
branch : trunk
2010-04-29 10:49:50 +02:00
holger krekel 030548bc73 expose py.code._reinterpret functions so that pypy and internal
uses don't need to go through internal implementation imports

--HG--
branch : trunk
2010-04-29 01:20:56 +02:00
Benjamin Peterson d93016d85f remove the unused return value of fnmatch_lines
--HG--
branch : trunk
2010-04-28 17:12:38 -05:00
holger krekel 22a50a5b88 * various jython related fixes.
* more care for print-errors including unicode-encoding related errors.

--HG--
branch : trunk
2010-04-28 15:24:38 +02:00
holger krekel 78d33a2f28 * rather expose internal exceptions under py.test.ACTION.Exception
with ACTION being skip, fail, exit, raises.
* move and refine test_outcome.py tests into runner tests

--HG--
branch : trunk
2010-04-28 08:42:56 +02:00
holger krekel d5e463605e * properly expose and document runtest-protocol related Exceptions
and move all definitions to the runner plugin for now.

* also move EXIT codes to session.py, obsoleting outcome.py alltogether.

--HG--
branch : trunk
2010-04-27 21:13:09 +02:00
holger krekel ed7a2d2da3 refine/fix isimportable-logic and ensure that 'tmpdir' has a python-importable name
--HG--
branch : trunk
2010-04-27 16:10:25 +02:00
holger krekel 8131f5bdc0 (fixes issue83) don't try to import conftest from an invalid package path, refine path.pyimport() logic
--HG--
branch : trunk
2010-04-27 15:49:13 +02:00
holger krekel c8d78177b9 (fixes issue85) correctly write non-ascii test output to junitxml files, refine some internal methods for it
--HG--
branch : trunk
2010-04-27 15:15:43 +02:00
holger krekel f6a04b92d2 fix unicode issues (port of pypy/py repo changeset r72526 by Armin)
--HG--
branch : trunk
2010-04-27 12:23:13 +02:00
Benjamin Peterson 7629b8fda7 make test source syntax valid
--HG--
branch : trunk
2010-04-23 20:49:00 -05:00
Benjamin Peterson d1b45ef3d4 add a helper to get a function's code
--HG--
branch : trunk
2010-04-23 20:39:40 -05:00
Benjamin Peterson f16d54f9a8 merge main
--HG--
branch : trunk
2010-04-23 20:28:32 -05:00
Benjamin Peterson d909aead4e provide encoding to dupfile() for py3
--HG--
branch : trunk
2010-04-23 20:27:34 -05:00
holger krekel 0b24a70279 this should test and fix the same issue that was committed in
the pypy svn-repo as r72534

--HG--
branch : trunk
2010-04-23 19:28:41 +02:00
holger krekel b3a05b545e another couple of checks on jython, still some problems
--HG--
branch : trunk
2010-04-23 19:05:22 +02:00
holger krekel 221ac3e466 a couple of more mostly jython-related fixes
--HG--
branch : trunk
2010-04-23 13:29:28 +02:00
hpk@tannit.openend.se 4337702a6a fixes for testrun on jython
--HG--
branch : trunk
2010-04-23 12:05:29 +02:00
holger krekel 85d35f7418 introduce an experimental approach for allowing dynamic addition of hooks from plugin. Plugins may register new hooks by implementing the new
pytest_registerhooks(pluginmanager)

and call

    pluginmanager.registerhooks(module)

with the referenced 'module' object containing the hooks.

The new pytest_registerhooks is called after pytest_addoption
and before pytest_configure.

--HG--
branch : trunk
2010-04-22 11:57:57 +02:00
holger krekel cbb4c0dadc use taskkill cmdline for jython/win32 but skip test on jython because it does not return a subprocess PID
--HG--
branch : trunk
2010-04-21 06:23:19 -07:00
holger krekel c10f0c2c36 merge in fixes
--HG--
branch : trunk
2010-04-21 14:49:38 +02:00
holger krekel 061f4c1515 robustify check
--HG--
branch : trunk
2010-04-21 14:46:41 +02:00
holger krekel fe34a8a15a a couple of more fixes/refinements for getting py.test to run better on jython/win32
--HG--
branch : trunk
2010-04-21 03:50:03 -07:00
holger krekel 5715bbd6f5 refining the win32 checks some further
--HG--
branch : trunk
2010-04-20 20:08:52 +02:00
holger krekel 536252cb2e refine win32 checks to also work on top of jython/win32
--HG--
branch : trunk
2010-04-20 10:45:41 -07:00
holger krekel c7326f1949 fix a pdb problem when dropping to a "raises" related failure
--HG--
branch : trunk
2010-02-08 14:17:01 +01:00
holger krekel d163d92b33 actually look into all non-dot subdirs for conftest.py files - recursive walk would be too heavy for large source trees but first-level subdirs are fine IMO. Note that prior to py.test 1.0 doing this "look-ahead" was not easily doable because it was hard to avoid global state in conftest.py, this is not true anymore - so i feel ok telling people to cleanup their conftest files if they get problems (you can imagine people doing all kinds of things at global conftest.py module scope, can't you?)
--HG--
branch : trunk
2010-02-06 22:37:04 +01:00
holger krekel 105ed6dcaa fix this test
--HG--
branch : trunk
2010-02-05 22:57:46 +01:00
holger krekel a3d15b2c60 refined usage and options for "py.cleanup":
py.cleanup     # remove "*.pyc" and "*$py.class" (jython) files
    py.cleanup -e .swp -e .cache # also remove files with these extensions
    py.cleanup -s  # remove "build" and "dist" directory next to setup.py files
    py.cleanup -d  # also remove empty directories
    py.cleanup -a  # synonym for "-s -d -e 'pip-log.txt'"
    py.cleanup -n  # dry run, only show what would be removed

--HG--
branch : trunk
2010-02-05 22:50:41 +01:00
holger krekel 3234e6e978 add a --funcargs option showing available funcargs
--HG--
branch : trunk
2010-02-04 23:45:07 +01:00
holger krekel 02c129df7a fix a test
--HG--
branch : trunk
2010-02-04 16:13:30 +01:00
holger krekel f95877a09b show a short and nice traceback for funcarg lookup errors
--HG--
branch : trunk
2010-02-04 16:01:02 +01:00
holger krekel 7bd60b5abb check and load test*/conftest.py early from anchors -
this makes it a bit more convenient to have command line options
available from a root directory of a project that does not
directly contain a conftest.py

--HG--
branch : trunk
2010-02-04 12:26:53 +01:00
holger krekel 9d64d7e27a refine setup ordering some more - test and avoid a problem with funcarg setups where the
surrounding setup_module would fail, but the funcarg setup still be called (which might
assume that setup_module has been called so would raise a confusing error)

--HG--
branch : trunk
2010-01-28 15:36:27 +01:00
holger krekel a2af204687 again addresses issue78 : we now call teardown also if setup raised a Skipped exception.
I also made sure, setup_module/class will only be called once - before they'd be call again
and again if they raise an error or a skip - for each test in their scope.

--HG--
branch : trunk
2010-01-28 14:20:58 +01:00
holger krekel 4d5ea7be43 install pygments for tests
--HG--
branch : trunk
2010-01-27 13:02:02 +01:00
holger krekel 98608611af closes #67 new super-short traceback-printing option: "--tb=line" will print a single line for each failing (python) test indicating its filename, lineno and the failure value
--HG--
branch : trunk
2010-01-27 12:52:19 +01:00
holger krekel b18ab6e03b fix issue78 - now python-level teardown functions are now called even if the setup failed.
Important detail: if the setup raises a Skipped exception, teardown will not be called.  This helps
to avoid breaking setup_module/class that performs a skip - it would otherwise internally
be considered as a "successful" setup in order to have teardown called later.  I guess
it also makes sense to treat Skip specially because it is unlikely a teardown should be
called if a Skip was raised on setup.

In any case, failing setups and teardowns will be reported separately.

--HG--
branch : trunk
2010-01-27 12:09:30 +01:00
holger krekel f7c562e492 better default for bogus terminal getdimensions() call, fixes issue63
--HG--
branch : trunk
2010-01-19 10:34:41 +01:00
holger krekel d3c0ff3a1f make sure we get an absolute path when writing the genscript file
--HG--
branch : trunk
2010-01-18 16:48:20 +01:00
holger krekel 55fcc5a219 always directly use basename for tracebacks, independently from code.path
fixes issue77 although i guess it was already fixed before.

--HG--
branch : trunk
2010-01-18 12:12:18 +01:00
holger krekel 0149771997 refine excludepath handling to treat entries with no path as matching
--HG--
branch : trunk
2010-01-18 03:04:20 +01:00
holger krekel 89068d9471 fix python2.4 issue
--HG--
branch : trunk
2010-01-18 02:01:16 +01:00
holger krekel d483f18374 move rsync reporting out
--HG--
branch : trunk
2010-01-18 00:41:22 +01:00
holger krekel 95de17b652 refine tests and refine code to deal with new xdist semantics.
--HG--
branch : trunk
2010-01-17 23:23:02 +01:00
holger krekel 09671eb6fc rename logxml plugin to junitxml
--HG--
branch : trunk
2010-01-16 23:33:26 +01:00
holger krekel 6f0db1d193 kill unused code
--HG--
branch : trunk
2010-01-16 19:41:05 +01:00
holger krekel 76e49b57bf fix test_importall to not stop on skipped plugins and fix the uncovered failure of genscript: standalone.py template is now safely importable
--HG--
branch : trunk
2010-01-15 18:45:06 +01:00
holger krekel 4a568f43fe get rid of the funccollector node, which nice-ifies names of funcarg-generated tests nodes, also test and fix one anomaly wrt to funcarg setups and instance uniqueness
--HG--
branch : trunk
2010-01-15 17:50:02 +01:00
holger krekel ee2f292efa remove superflous building of a dict, preserve order for nodes that have identical file:lineno
--HG--
branch : trunk
2010-01-15 17:38:09 +01:00
holger krekel 030986dcc4 reduce usage of the global py.test.config which maybe should die or become less global at some point (along with py.test.ensuretemp)
--HG--
branch : trunk
2010-01-13 18:04:58 +01:00
holger krekel 9da1ba40ed move down py/impl/XYZ to py/_XYZ
--HG--
branch : trunk
2010-01-13 17:15:54 +01:00
holger krekel 5c27076d32 flatten test directory hierarchy and merge smaller into larger files
--HG--
branch : trunk
2010-01-13 16:17:50 +01:00
holger krekel 40f41496d8 remove dist-testing and looponfail code from core. there remain some (pytest_runner particularly) tests that test both plain and dist modes which cannot be easily dis-entangled. food for thought.
--HG--
branch : trunk
2010-01-13 16:00:33 +01:00
holger krekel d4f5073076 remove figleaf which now lives "outside"
--HG--
branch : trunk
2010-01-13 00:47:20 +01:00
holger krekel 59f3adb46b fix reqs2 to point to released execnet
--HG--
branch : trunk
2010-01-12 21:57:26 +01:00
holger krekel d53572a710 introduce a new pytest_report_header(hook) hook to add additional test-run relevant information to the header of a test report.
--HG--
branch : trunk
2010-01-12 21:43:25 +01:00
holger krekel a9fe84d9b9 adding a second requirements file which uses execnet-1.0.2
--HG--
branch : trunk
2010-01-12 16:15:07 +01:00
holger krekel 1b0d6296dd test and fix looponfailing wrt to a bug introduced with the cmdline/session startup cleanup.
--HG--
branch : trunk
2010-01-12 16:08:48 +01:00
holger krekel 8d9e0712be refine classname normalization for junit-xml
--HG--
branch : trunk
2010-01-12 01:35:50 +01:00
holger krekel 3296939eda fix sessionstart/sessionfinish handling at the slave side, set "session.nodeid" to id of the slave and make sure "final" teardown failures are reported nicely. fixes issue66.
--HG--
branch : trunk
2010-01-11 17:09:07 +01:00
holger krekel ba1451330e refine rsyncing and internal dir/transferal handling: don't transfer roots in a popen- no-chdir situation and only use one py._pydir everywhere
--HG--
branch : trunk
2010-01-11 14:30:50 +01:00
holger krekel 352e305431 fix and test bug: dist-testing now works again without execnet/pylib installed remotely. fixes issue65.
--HG--
branch : trunk
2010-01-10 23:52:23 +01:00
holger krekel 99301a0dae (experimental) allow cmdline arguments to deep-point to a test, also remove virtually redundant session.getinitialitems() calls
--HG--
branch : trunk
2010-01-10 21:29:36 +01:00
holger krekel 3029aa6558 fix some "import py" test issues, and prevent "genscript" script from having dist-options
--HG--
branch : trunk
2010-01-10 20:45:37 +01:00
holger krekel 3239bd250b avoid dependency on directory ordering
--HG--
branch : trunk
2010-01-03 18:19:52 +01:00
holger krekel 9fcd108091 relax a test to pass on jython and fix install docs to include genscript standalone usage.
--HG--
branch : trunk
2010-01-03 14:19:31 +01:00