summaryrefslogtreecommitdiff
path: root/testing/acceptance_test.py
AgeCommit message (Collapse)Author
2020-12-05Merge pull request #8055 from bluetech/unraisableRan Benita
Add unraisableexception and threadexception plugins
2020-11-25Refactor acceptance_test to use pytester (#8070)Dominic Mortlock
2020-11-20testing: fix ResourceWarning in broken-pipe testRan Benita
2020-10-12New pytester fixture (#7854)Bruno Oliveira
2020-10-03py36+: pyupgrade: py36+Anthony Sottile
2020-10-02Merge pull request #7835 from asottile/py36_miscAnthony Sottile
py36+: miscellaneous (3, 6) cleanup
2020-10-02py36+: miscellaneous (3, 6) cleanupAnthony Sottile
2020-10-02py36+: remove _pytest.compat.MODULE_NOT_FOUND_ERRORAnthony Sottile
2020-08-19Remove broken pytest_collect_directory hookBruno Oliveira
2020-08-15Refactor Session._parsearg into a separate function for testingBruno Oliveira
2020-08-06Replace some usages of py.path.localRan Benita
2020-08-03testing: fix some docstring issuesRan Benita
In preparation for enforcing some docstring lints.
2020-07-22Change pytest deprecation warnings into errors for 6.0 release (#7362)Bruno Oliveira
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-07-01testing: fix flaky tests due to "coroutine never awaited" warningsRan Benita
They sometime leak into other test's warnings and cause them to fail.
2020-06-22config: improve typingRan Benita
2020-06-13Introduce --import-mode=importlib (#7246)Bruno Oliveira
Fix #5821 Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-06-12Fix some type errors around py.path.localRan Benita
These errors are found using a typed version of py.path.local.
2020-06-08Fix issue where working dir becomes wrong on subst drive on Windows. Fixes ↵Fabio Zadrozny
#5965 (#6523) Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-05-23Introduce _pytest.timing as a way to control timing during testsBruno Oliveira
_pytest.timing is an indirection to 'time' functions, which pytest production code should use instead of 'time' directly. 'mock_timing' is a new fixture which then mocks those functions, allowing us to write time-reliable tests which run instantly and are not flaky. This was triggered by recent flaky junitxml tests on Windows related to timing issues.
2020-05-08Handle EPIPE/BrokenPipeError in pytest's CLIRan Benita
Running `pytest | head -1` and similar causes an annoying error to be printed to stderr: Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> BrokenPipeError: [Errno 32] Broken pipe (or possibly even a propagating exception in older/other Python versions). The standard UNIX behavior is to handle the EPIPE silently. To recommended method to do this in Python is described here: https://docs.python.org/3/library/signal.html#note-on-sigpipe It is not appropriate to apply this recommendation to `pytest.main()`, which is used programmatically for in-process runs. Hence, change pytest's entrypoint to a new `pytest.console_main()` function, to be used exclusively by pytest's CLI, and add the SIGPIPE code there. Fixes #4375.
2020-04-24pre-commit: update pyupgrade 1.18.0 -> 2.2.1Ran Benita
2020-04-24testing: avoid pytest_collect_directory message in warnings summaryRan Benita
Currently this test issues a warning which is displayed in the warning summary (of pytest's own test suite): testing/acceptance_test.py::TestGeneralUsage::test_early_skip /tmp/pytest-of-ran/pytest-396/test_early_skip0/conftest.py:2: PytestDeprecationWarning: The pytest_collect_directory hook is not working. Please use collect_ignore in conftests or pytest_collection_modifyitems. def pytest_collect_directory(): I think the filter was meant to be `ignore` in the first place, and not `always` which is not a valid action AFAIK.
2020-04-06Fix flaky TestDurations testRan Benita
TestDurations tests the `--durations=N` functionality which reports N slowest tests, with durations <= 0.005s not shown by default. The test relies on real time.sleep() (in addition to the code which uses time.perf_counter()) which makes it flaky and inconsistent between platforms. Instead of trying to tweak it more, make it use fake time instead. The way it is done is a little hacky but seems to work.
2020-03-29Improved time counter used to compute test durations. (#6939)smarie
Co-authored-by: Sylvain MARIE <sylvain.marie@se.com> Co-authored-by: Ran Benita <ran@unusedvar.com> Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-03-27Change EnvironmentError, IOError to OSError - they are aliasesRan Benita
Since Python 3.3, these are aliases for OSError: https://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy
2020-03-03fix #571: deprecate pytest_collect_directory as ... (#6847)Ronny Pfannschmidt
Deprecate pytest_collect_directory Fix #571 Co-authored-by: Daniel Hahler <github@thequod.de>
2020-02-22main: `args` must be a list, not tuple (#6791)Daniel Hahler
Passing in a tuple crashes in `_prepareconfig`: def test_invoke_with_tuple(self): > pytest.main(("-h",)) src/_pytest/config/__init__.py:82: in main config = _prepareconfig(args, plugins) src/_pytest/config/__init__.py:229: in _prepareconfig return pluginmanager.hook.pytest_cmdline_parse( … src/_pytest/helpconfig.py:98: in pytest_cmdline_parse config = outcome.get_result() # type: Config src/_pytest/config/__init__.py:808: in pytest_cmdline_parse self.parse(args) src/_pytest/config/__init__.py:1017: in parse self._preparse(args, addopts=addopts) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def _preparse(self, args: List[str], addopts: bool = True) -> None: … if addopts: ini_addopts = self.getini("addopts") if ini_addopts: > args[:] = self._validate_args(ini_addopts, "via addopts config") + args E TypeError: can only concatenate list (not "tuple") to list addopts = True args = ('-h',) env_addopts = '' ini_addopts = ['-rfEX', …] src/_pytest/config/__init__.py:956: TypeError: can only concatenate list (not "tuple") to list Might be worth handling (converting it to a list for example), but it was documented to be a list to begin with when removing support for strings (a7e401656).
2020-02-14tests: harden test_better_reporting_on_conftest_load_failure (#6713)Daniel Hahler
2020-02-12Merge pull request #6673 from sscherfke/featuresBruno Oliveira
Reverse / fix meaning of "+/-" in error diffs
2020-02-11Merge remote-tracking branch 'upstream/master' into mmBruno Oliveira
Conflicts: src/_pytest/main.py src/_pytest/mark/structures.py src/_pytest/python.py testing/test_main.py testing/test_parseopt.py
2020-02-10Move ExitCode's definition from _pytest.main to _pytest.configRan Benita
ExitCode is used in several internal modules and hooks and so with type annotations added, needs to be imported a lot. _pytest.main, being the entry point, generally sits at the top of the import tree. So, it's not great to have ExitCode defined in _pytest.main, because it will cause a lot of import cycles once type annotations are added (in fact there is already one, which this change removes). Move it to _pytest.config instead. _pytest.main still imports ExitCode, so importing from there still works, although external users should really be importing from `pytest`.
2020-02-10Reverse / fix meaning of "+/-" in error diffsStefan Scherfke
The convention is "assert result is expected". Pytest's error diffs now reflect this. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result. Fixes: #3333
2020-02-04testing/conftest.py: testdir: set PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 (#6655)Daniel Hahler
Fixes https://github.com/pytest-dev/pytest/pull/4518.
2020-01-22Merge remote-tracking branch 'upstream/master' into mmBruno Oliveira
Conflicts: * src/_pytest/_code/code.py * src/_pytest/main.py * testing/python/metafunc.py * testing/test_parseopt.py * testing/test_pytester.py
2020-01-16tests: cleanup unused fixturesDaniel Hahler
2020-01-16Update junit_logging with no,log,system-out,system-err,out-err,allJakub Mitoraj
2019-12-09Include new --capture-mode=tee-sys optioncmachalo
Fix #4597
2019-11-19Merge remote-tracking branch 'upstream/master' into release-5.3.0Bruno Oliveira
2019-11-18Remove check for os.symlink, always there in py3+Anthony Sottile
2019-11-07_perform_collect: remove comment about untested codeDaniel Hahler
Harden one test where it is tested. All tests testing this: testing/acceptance_test.py:184(TestGeneralUsage::test_not_collectable_arguments) testing/acceptance_test.py:373(TestGeneralUsage::test_direct_addressing_notfound) testing/acceptance_test.py:403(TestGeneralUsage::test_issue134_report_error_when_collecting_member[test_fun.py::test_a]) testing/acceptance_test.py:420(TestGeneralUsage::test_report_all_failed_collections_initargs) testing/test_config.py:1309(test_config_blocked_default_plugins[python]) (via https://github.com/blueyed/pytest/pull/88)
2019-10-27Fix plurality mismatch for and in pytest terminal summaryMarcoGorelli
2019-10-23doctest: pytest_unconfigure: reset RUNNER_CLASSDaniel Hahler
This is important when used with ``pytester``'s ``runpytest_inprocess``. Since 07f20ccab `pytest testing/acceptance_test.py -k test_doctest_id` would fail, since the second run would not consider the exception to be an instance of `doctest.DocTestFailure` anymore, since the module was re-imported, and use another failure message then in the short test summary info (and in the report itself): > FAILED test_doctest_id.txt::test_doctest_id.txt - doctest.DocTestFailure: <Do... while it should be: > FAILED test_doctest_id.txt::test_doctest_id.txt
2019-10-06Introduce no_fnmatch_line/no_re_match_line in pytester (#5914)Bruno Oliveira
Introduce no_fnmatch_line/no_re_match_line in pytester
2019-10-06Use new no-match functions to replace previous idiomBruno Oliveira
2019-10-06Allow for "pdb" module to be rewrittenDaniel Hahler
2019-08-15Merge remote-tracking branch 'upstream/master' into mmBruno Oliveira
Conflicts: src/_pytest/outcomes.py
2019-08-15also warn on awaitable or async iterable test resultsThomas Grainger
2019-08-15Issue a warning for async gen functionsThomas Grainger
Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
2019-07-09Remove deprecated features (#5529)Bruno Oliveira
Remove deprecated features
2019-07-04Replace importlib_metadata with importlib.metadata on Python 3.8+Miro Hrončok
Fixes https://github.com/pytest-dev/pytest/issues/5537