New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tmpdir port pathlib #3988

Merged
merged 25 commits into from Oct 12, 2018

Conversation

Projects
None yet
5 participants
@RonnyPfannschmidt
Member

RonnyPfannschmidt commented Sep 15, 2018

this pr is to port tmpdir over to pathlib

the following steps have to be implemented

Fix #3985

@coveralls

This comment has been minimized.

coveralls commented Sep 16, 2018

Coverage Status

Coverage increased (+0.007%) to 93.773% when pulling 4736b2b on RonnyPfannschmidt:tmpdir-port-pathlib into 8ecdd4e on pytest-dev:features.

@@ -2,21 +2,116 @@
from __future__ import absolute_import, division, print_function
import re
from six.moves import reduce

This comment has been minimized.

@asottile

asottile Sep 16, 2018

Member

in py27+ you can consistently import this from functools import reduce -- would be a regression of #3609

self._basetemp = t = basetemp.realpath()
self.trace("new basetemp", t)
return t
return py.path.local(self.tmppath_factory.getbasetemp().resolve())

This comment has been minimized.

@asottile

asottile Sep 16, 2018

Member

ah ok, so it still returns a py.path for now?

This comment has been minimized.

@RonnyPfannschmidt

RonnyPfannschmidt Sep 16, 2018

Member

the shim and the old api must stay compatible

This comment has been minimized.

@asottile

asottile Sep 16, 2018

Member

makes sense, another approach might be to write an adapter class which has the interface of py.path._Path but keeps a pathlib object internally -- I suspect we'll want something like this anyway to make a path forward for methods like as_cwd() which have no equivalent in pathlib

This comment has been minimized.

@RonnyPfannschmidt

RonnyPfannschmidt Sep 16, 2018

Member

@asottile that stuff should be using monkeypatch - i am perfectly fine with not replicating py.path.local - it has major issues with miss-alinged feature creep and bad api, and i really dont want to inherit that into a new api

my plan is to support pathlib everywhere, and then make it possible to run without py.path.local

This comment has been minimized.

@asottile

asottile Sep 16, 2018

Member

I'd be a little sad to see some of the apis go. I for one use:

with tmpdir.join('somepath').ensure_dir().as_cwd():
    ...

quite a lot

This comment has been minimized.

@RonnyPfannschmidt

RonnyPfannschmidt Sep 16, 2018

Member

ensure is going to go away as well - i wonder where you use that patter, since its a bit pathological in common usage and i consider it a anti-pattern

This comment has been minimized.

@asottile

asottile Sep 16, 2018

Member

most of my tests, actually 😆

$ all-repos-grep -l -E '\.(as_cwd|ensure(|_dir))\(\)'
repos/asottile/all-repos:tests/push/github_pull_request_test.py
repos/asottile/all-repos-depends:tests/conftest.py
repos/asottile/all-repos-depends:tests/depends_test.py
repos/asottile/all-repos-depends:tests/lang/python_test.py
repos/asottile/all-repos-depends:tests/packages_test.py
repos/asottile/aspy.refactor_imports:tests/classify_test.py
repos/asottile/aspy.refactor_imports:tests/conftest.py
repos/asottile/aspy.refactor_imports:tests/sort_test.py
repos/asottile/git-code-debt:tests/server/app_test.py
repos/asottile/no-manylinux1:tests/integration_test.py
repos/asottile/reorder_python_imports:tests/reorder_python_imports_test.py
repos/asottile/rubyvenv:tests/rubyvenv_test.py
repos/asottile/seed-isort-config:tests/seed_isort_config_test.py
repos/asottile/yesqa:tests/yesqa_test.py
repos/pre-commit/pre-commit:tests/commands/run_test.py
repos/pre-commit/pre-commit:tests/git_test.py
repos/pre-commit/pre-commit:tests/languages/pygrep_test.py
repos/pre-commit/pre-commit:tests/parse_shebang_test.py
repos/pre-commit/pre-commit:tests/repository_test.py
repos/pre-commit/pre-commit:tests/staged_files_only_test.py
repos/pre-commit/pre-commit-hooks:tests/autopep8_wrapper_test.py
repos/pre-commit/pre-commit-hooks:tests/check_added_large_files_test.py
repos/pre-commit/pre-commit-hooks:tests/check_case_conflict_test.py
repos/pre-commit/pre-commit-hooks:tests/check_merge_conflict_test.py
repos/pre-commit/pre-commit-hooks:tests/check_symlinks_test.py
repos/pre-commit/pre-commit-hooks:tests/check_vcs_permalinks_test.py
repos/pre-commit/pre-commit-hooks:tests/forbid_new_submodules_test.py
repos/pre-commit/pre-commit-hooks:tests/no_commit_to_branch_test.py
repos/pre-commit/pre-commit-mirror-maker:tests/make_repo_test.py
repos/sass/libsass-python:sasstests.py

This comment has been minimized.

@RonnyPfannschmidt

RonnyPfannschmidt Sep 16, 2018

Member

@asottile should i fix them?

This comment has been minimized.

@asottile

asottile Sep 16, 2018

Member

ehhhhhh I can fix them if the apis go away

if x.name.lower().startswith(l_prefix)
),
-1,
)

This comment has been minimized.

@asottile

asottile Sep 16, 2018

Member

this code was a major head scratcher for me, maybe refactor it to not use reduce?

This comment has been minimized.

@RonnyPfannschmidt

RonnyPfannschmidt Sep 16, 2018

Member

there is not max(iterable, default=...) on python2

This comment has been minimized.

@asottile

asottile Sep 16, 2018

Member

🤷‍♂️ the for loop might be more readable, or try: n = max(...) except TypeError: n = ...

This comment has been minimized.

@RonnyPfannschmidt

RonnyPfannschmidt Sep 16, 2018

Member

i extracted it a bit - the for loop is slower due to executing on the interpreter, impending push after i have a first iteration of folder cleanup

Show resolved Hide resolved .pre-commit-config.yaml
@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Sep 18, 2018

just a note on the lack of progress, i caught a cold

@nicoddemus

This comment has been minimized.

Member

nicoddemus commented Sep 18, 2018

Sorry to hear, get better soon!

@codecov

This comment has been minimized.

codecov bot commented Sep 18, 2018

Codecov Report

Merging #3988 into features will increase coverage by <.01%.
The diff coverage is 92.98%.

Impacted file tree graph

@@             Coverage Diff              @@
##           features    #3988      +/-   ##
============================================
+ Coverage     94.52%   94.53%   +<.01%     
============================================
  Files           109      109              
  Lines         23939    24142     +203     
  Branches       2362     2382      +20     
============================================
+ Hits          22629    22822     +193     
- Misses         1001     1009       +8     
- Partials        309      311       +2
Flag Coverage Δ
#doctesting 28.53% <50.35%> (-0.57%) ⬇️
#linux 94.38% <92.28%> (ø) ⬆️
#nobyte 0% <0%> (ø) ⬆️
#numpy 28.25% <52.46%> (+0.25%) ⬆️
#pexpect 0% <0%> (ø) ⬆️
#py27 92.63% <90.87%> (ø) ⬆️
#py34 92.06% <90.87%> (ø) ⬆️
#py35 92.07% <90.87%> (ø) ⬆️
#py36 92.63% <90.87%> (ø) ⬆️
#py37 92.27% <90.87%> (-0.01%) ⬇️
#trial 31.45% <52.46%> (+0.22%) ⬆️
#windows 93.8% <92.98%> (-0.08%) ⬇️
#xdist 18.95% <50%> (+0.28%) ⬆️
Impacted Files Coverage Δ
src/_pytest/compat.py 96.55% <ø> (-0.08%) ⬇️
src/_pytest/main.py 96.19% <ø> (ø) ⬆️
src/_pytest/assertion/rewrite.py 95.35% <100%> (ø) ⬆️
src/_pytest/pytester.py 86.43% <100%> (+0.05%) ⬆️
testing/python/fixture.py 99.23% <100%> (ø) ⬆️
testing/test_paths.py 100% <100%> (ø) ⬆️
src/_pytest/tmpdir.py 100% <100%> (ø) ⬆️
src/_pytest/cacheprovider.py 96.9% <100%> (-0.02%) ⬇️
src/_pytest/deprecated.py 100% <100%> (ø) ⬆️
testing/test_tmpdir.py 100% <100%> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ecdd4e...4736b2b. Read the comment docs.

@nicoddemus

Looking pretty good so far. 👍

yield x
def extract_suffixees(iter, prefix):

This comment has been minimized.

@nicoddemus

nicoddemus Sep 20, 2018

Member

typo: "suffixees"

def make_numbered_dir_with_cleanup(root, prefix, keep, consider_lock_dead_after):
for i in range(10):

This comment has been minimized.

@nicoddemus

nicoddemus Sep 20, 2018

Member

Why the loop?

This comment has been minimized.

@RonnyPfannschmidt

RonnyPfannschmidt Sep 20, 2018

Member

this is part of the currency preparation

creating a folder may fail at the first level

a the second level in the timeframe between creating a folder and creating the lock cleanup might rename the folder

im toying with some ideas to limit the need for the loops but for practical purposes i am following the implementation of py.path.local.make_numbered_dir closely in that regard

@RonnyPfannschmidt RonnyPfannschmidt changed the title from [WIP] Tmpdir port pathlib to Tmpdir port pathlib Sep 26, 2018

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Sep 26, 2018

removing the wip, a few more exception handlers/ignorers might be needed

Show resolved Hide resolved src/_pytest/tmpdir.py Outdated
def make_numbered_dir_with_cleanup(root, prefix, keep, lock_timeout):
for i in range(10):
try:

This comment has been minimized.

@nicoddemus

nicoddemus Sep 26, 2018

Member

this try/except seems unnecessary given that it only re-raises any caught exception

Show resolved Hide resolved src/_pytest/tmpdir.py Outdated
root=root,
prefix=prefix,
keep=keep,
consider_lock_dead_after=consider_lock_dead_after,

This comment has been minimized.

@nicoddemus

nicoddemus Sep 26, 2018

Member

Is this correct? We are computing a consider_lock_dead_after as the current time (we just created p) + some time in the future, and we are using this date in the future to decide if a lock file can be considered dead in ensure_deletable. It seems to me we should be passing the current time plus a lock_timeout, and if the last mtime of a lock is less than current_time - lock_timeout, the lock can be considered dead.

Or am I missing something?

This comment has been minimized.

@RonnyPfannschmidt

RonnyPfannschmidt Sep 26, 2018

Member

good catch, i accidentally reversed the calculation

@attr.s
class TempPathFactory(object):

This comment has been minimized.

@nicoddemus

nicoddemus Sep 26, 2018

Member

Please add docstrings to all the public functions here as they will appear in the docs.

def __init__(self, config):
self.config = config
self.trace = config.trace.get("tmpdir")
tmppath_factory = attr.ib()

This comment has been minimized.

@nicoddemus

nicoddemus Sep 26, 2018

Member

We probably want to keep this private no?

This comment has been minimized.

@RonnyPfannschmidt

This comment has been minimized.

@nicoddemus

nicoddemus Oct 1, 2018

Member

It seems you missed this comment

@pytest.fixture
def tmp_path(tmpdir):

This comment has been minimized.

@nicoddemus

nicoddemus Sep 26, 2018

Member

docstring please

This comment has been minimized.

@nicoddemus

nicoddemus Oct 1, 2018

Member

missed this one too

@@ -143,6 +143,7 @@ def break_getuser(monkeypatch):
monkeypatch.delenv(envvar, raising=False)
@pytest.mark.skip(reason="creates random tmpdirs as part of a system level test")

This comment has been minimized.

@nicoddemus

nicoddemus Sep 26, 2018

Member

Are this skip and the next one in this file temporary?

This comment has been minimized.

@RonnyPfannschmidt

This comment has been minimized.

@nicoddemus

nicoddemus Oct 1, 2018

Member

This still needs to be addressed it seems

Show resolved Hide resolved testing/test_tmpdir.py

@RonnyPfannschmidt RonnyPfannschmidt changed the title from Tmpdir port pathlib to [WIP] Tmpdir port pathlib Sep 29, 2018

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Sep 29, 2018

the basic structural details are finished, but shutil.rmtree is insufficient since its rather limited,
i must reimplement rm -rf

delete_a_numbered_dir(path)
def cleanup_candidates(root, prefix, keep):

This comment has been minimized.

@nicoddemus

nicoddemus Sep 29, 2018

Member

This will not actually keep the number of directories, but will remove all directories with prefix smaller than the maximum one found minus keep. For example:

fun-10
fun-11
fun-12
fun-16
fun-20

With keep=3, only fun-20 will be left in the directory. keep=3 could be considered "leave the last 3 folders", in which case fun-12, fun-16 and fun-20 should be kept.

I don't mind either way, just mentioning this to make sure we are getting the behavior we want (and we should document it to be clear as well).

This comment has been minimized.

@RonnyPfannschmidt

RonnyPfannschmidt Sep 29, 2018

Member

@nicoddemus its the current behaviour

This comment has been minimized.

@nicoddemus

nicoddemus Sep 29, 2018

Member

I see, thanks. Let's make sure to document it later then. 👍

@RonnyPfannschmidt RonnyPfannschmidt changed the title from [WIP] Tmpdir port pathlib to Tmpdir port pathlib Oct 1, 2018

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Oct 1, 2018

i'll have to leave out forced delete, the python stdlib is too broken to do it reliably

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Oct 1, 2018

aka this will be a followup

@nicoddemus

Besides the comments below, I think that before merging we also need:

  • Changelog entry
  • Update the tmpdir docs and reference
Show resolved Hide resolved src/_pytest/pathlib.py
def _max(iterable, default):
"""needed due to python2.7 lacking the default argument for max"""
return reduce(max, iterable, default)

This comment has been minimized.

@nicoddemus

nicoddemus Oct 1, 2018

Member

I suggest to change this to:

if six.PY2:
    def _max(iterable, default):
        """needed due to python2.7 lacking the default argument for max"""
        return reduce(max, iterable, default)
else:
    _max = max

So it is easier to find when we start to cleanup the codebase after dropping Python 2. 😁

Show resolved Hide resolved src/_pytest/pathlib.py Outdated
Show resolved Hide resolved src/_pytest/tmpdir.py Outdated
Show resolved Hide resolved src/_pytest/tmpdir.py Outdated
Show resolved Hide resolved src/_pytest/tmpdir.py
def __init__(self, config):
self.config = config
self.trace = config.trace.get("tmpdir")
tmppath_factory = attr.ib()

This comment has been minimized.

@nicoddemus

nicoddemus Oct 1, 2018

Member

It seems you missed this comment

@pytest.fixture
def tmp_path(tmpdir):

This comment has been minimized.

@nicoddemus

nicoddemus Oct 1, 2018

Member

missed this one too

@@ -143,6 +143,7 @@ def break_getuser(monkeypatch):
monkeypatch.delenv(envvar, raising=False)
@pytest.mark.skip(reason="creates random tmpdirs as part of a system level test")

This comment has been minimized.

@nicoddemus

nicoddemus Oct 1, 2018

Member

This still needs to be addressed it seems

@@ -161,6 +162,7 @@ def test_some(tmpdir):
reprec.assertoutcome(passed=1)
@pytest.mark.skip(reason="creates random tmpdirs as part of a system level test")

This comment has been minimized.

@nicoddemus
@nicoddemus

Looks great, awesome work @RonnyPfannschmidt!

The only thing missing are docs (reference and updating the current tmpdir docs to mention the new tmp_path fixture).

@@ -109,3 +109,8 @@
PYTEST_NAMESPACE = RemovedInPytest4Warning(
"pytest_namespace is deprecated and will be removed soon"
)
PYTEST_ENSURETEMP = RemovedInPytest4Warning(

This comment has been minimized.

@nicoddemus

nicoddemus Oct 11, 2018

Member

We should add a deprecation changelog entry for that. 👍

Show resolved Hide resolved doc/en/tmpdir.rst
``tmpdir`` is a `pathlib/pathlib2.Path`_ object. Here is an example test usage::
# content of test_tmp_path.py

This comment has been minimized.

@nicoddemus

nicoddemus Oct 11, 2018

Member

I believe it is better to use .. code-block:: python so that blaken-docs can do its thing.

The base directory can be configured using the ``--basetemp`` option.
The base directory can be configured using the ``--basetemp`` option."""
given_basetemp = attr.ib()

This comment has been minimized.

@nicoddemus

nicoddemus Oct 11, 2018

Member

This is still public, I think it should really be private

"""docstring for ClassName"""
given_basetemp = attr.ib()
trace = attr.ib()

This comment has been minimized.

@nicoddemus

nicoddemus Oct 11, 2018

Member

This is still public, I think it should really be private

@nicoddemus

Awesome work, thanks!

Show resolved Hide resolved .pre-commit-config.yaml

@nicoddemus nicoddemus merged commit 933de16 into pytest-dev:features Oct 12, 2018

3 of 4 checks passed

codecov/patch 92.98% of diff hit (target 94.52%)
Details
codecov/project 94.53% (+<.01%) compared to 8ecdd4e
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@nicoddemus

This comment has been minimized.

Member

nicoddemus commented Oct 12, 2018

🎉

peterbe added a commit to mozilla-services/tecken that referenced this pull request Oct 25, 2018

Update pytest to 3.9.2 (#1264)
This PR updates [pytest](https://pypi.org/project/pytest) from **3.8.2** to **3.9.2**.



<details>
  <summary>Changelog</summary>
  
  
   ### 3.9.2
   ```
   =========================

Bug Fixes
---------

- `2909 &lt;https://github.com/pytest-dev/pytest/issues/2909&gt;`_: Improve error message when a recursive dependency between fixtures is detected.


- `3340 &lt;https://github.com/pytest-dev/pytest/issues/3340&gt;`_: Fix logging messages not shown in hooks ``pytest_sessionstart()`` and ``pytest_sessionfinish()``.


- `3533 &lt;https://github.com/pytest-dev/pytest/issues/3533&gt;`_: Fix unescaped XML raw objects in JUnit report for skipped tests


- `3691 &lt;https://github.com/pytest-dev/pytest/issues/3691&gt;`_: Python 2: safely format warning message about passing unicode strings to ``warnings.warn``, which may cause
  surprising ``MemoryError`` exception when monkey patching ``warnings.warn`` itself.


- `4026 &lt;https://github.com/pytest-dev/pytest/issues/4026&gt;`_: Improve error message when it is not possible to determine a function&#39;s signature.


- `4177 &lt;https://github.com/pytest-dev/pytest/issues/4177&gt;`_: Pin ``setuptools&gt;=40.0`` to support ``py_modules`` in ``setup.cfg``


- `4179 &lt;https://github.com/pytest-dev/pytest/issues/4179&gt;`_: Restore the tmpdir behaviour of symlinking the current test run.


- `4192 &lt;https://github.com/pytest-dev/pytest/issues/4192&gt;`_: Fix filename reported by ``warnings.warn`` when using ``recwarn`` under python2.
   ```
   
  
  
   ### 3.9.1
   ```
   =========================

Features
--------

- `4159 &lt;https://github.com/pytest-dev/pytest/issues/4159&gt;`_: For test-suites containing test classes, the information about the subclassed
  module is now output only if a higher verbosity level is specified (at least
  &quot;-vv&quot;).
   ```
   
  
  
   ### 3.9.0
   ```
   =========================================================================

Deprecations
------------

- `3616 &lt;https://github.com/pytest-dev/pytest/issues/3616&gt;`_: The following accesses have been documented as deprecated for years, but are now actually emitting deprecation warnings.

  * Access of ``Module``, ``Function``, ``Class``, ``Instance``, ``File`` and ``Item`` through ``Node`` instances. Now
    users will this warning::

          usage of Function.Module is deprecated, please use pytest.Module instead

    Users should just ``import pytest`` and access those objects using the ``pytest`` module.

  * ``request.cached_setup``, this was the precursor of the setup/teardown mechanism available to fixtures. You can
    consult `funcarg comparison section in the docs &lt;https://docs.pytest.org/en/latest/funcarg_compare.html&gt;`_.

  * Using objects named ``&quot;Class&quot;`` as a way to customize the type of nodes that are collected in ``Collector``
    subclasses has been deprecated. Users instead should use ``pytest_collect_make_item`` to customize node types during
    collection.

    This issue should affect only advanced plugins who create new collection types, so if you see this warning
    message please contact the authors so they can change the code.

  * The warning that produces the message below has changed to ``RemovedInPytest4Warning``::

          getfuncargvalue is deprecated, use getfixturevalue


- `3988 &lt;https://github.com/pytest-dev/pytest/issues/3988&gt;`_: Add a Deprecation warning for pytest.ensuretemp as it was deprecated since a while.



Features
--------

- `2293 &lt;https://github.com/pytest-dev/pytest/issues/2293&gt;`_: Improve usage errors messages by hiding internal details which can be distracting and noisy.

  This has the side effect that some error conditions that previously raised generic errors (such as
  ``ValueError`` for unregistered marks) are now raising ``Failed`` exceptions.


- `3332 &lt;https://github.com/pytest-dev/pytest/issues/3332&gt;`_: Improve the error displayed when a ``conftest.py`` file could not be imported.

  In order to implement this, a new ``chain`` parameter was added to ``ExceptionInfo.getrepr``
  to show or hide chained tracebacks in Python 3 (defaults to ``True``).


- `3849 &lt;https://github.com/pytest-dev/pytest/issues/3849&gt;`_: Add ``empty_parameter_set_mark=fail_at_collect`` ini option for raising an exception when parametrize collects an empty set.


- `3964 &lt;https://github.com/pytest-dev/pytest/issues/3964&gt;`_: Log messages generated in the collection phase are shown when
  live-logging is enabled and/or when they are logged to a file.


- `3985 &lt;https://github.com/pytest-dev/pytest/issues/3985&gt;`_: Introduce ``tmp_path`` as a fixture providing a Path object.


- `4013 &lt;https://github.com/pytest-dev/pytest/issues/4013&gt;`_: Deprecation warnings are now shown even if you customize the warnings filters yourself. In the previous version
  any customization would override pytest&#39;s filters and deprecation warnings would fall back to being hidden by default.


- `4073 &lt;https://github.com/pytest-dev/pytest/issues/4073&gt;`_: Allow specification of timeout for ``Testdir.runpytest_subprocess()`` and ``Testdir.run()``.


- `4098 &lt;https://github.com/pytest-dev/pytest/issues/4098&gt;`_: Add returncode argument to pytest.exit() to exit pytest with a specific return code.


- `4102 &lt;https://github.com/pytest-dev/pytest/issues/4102&gt;`_: Reimplement ``pytest.deprecated_call`` using ``pytest.warns`` so it supports the ``match=&#39;...&#39;`` keyword argument.

  This has the side effect that ``pytest.deprecated_call`` now raises ``pytest.fail.Exception`` instead
  of ``AssertionError``.


- `4149 &lt;https://github.com/pytest-dev/pytest/issues/4149&gt;`_: Require setuptools&gt;=30.3 and move most of the metadata to ``setup.cfg``.



Bug Fixes
---------

- `2535 &lt;https://github.com/pytest-dev/pytest/issues/2535&gt;`_: Improve error message when test functions of ``unittest.TestCase`` subclasses use a parametrized fixture.


- `3057 &lt;https://github.com/pytest-dev/pytest/issues/3057&gt;`_: ``request.fixturenames`` now correctly returns the name of fixtures created by ``request.getfixturevalue()``.


- `3946 &lt;https://github.com/pytest-dev/pytest/issues/3946&gt;`_: Warning filters passed as command line options using ``-W`` now take precedence over filters defined in ``ini``
  configuration files.


- `4066 &lt;https://github.com/pytest-dev/pytest/issues/4066&gt;`_: Fix source reindenting by using ``textwrap.dedent`` directly.


- `4102 &lt;https://github.com/pytest-dev/pytest/issues/4102&gt;`_: ``pytest.warn`` will capture previously-warned warnings in Python 2. Previously they were never raised.


- `4108 &lt;https://github.com/pytest-dev/pytest/issues/4108&gt;`_: Resolve symbolic links for args.

  This fixes running ``pytest tests/test_foo.py::test_bar``, where ``tests``
  is a symlink to ``project/app/tests``:
  previously ``project/app/conftest.py`` would be ignored for fixtures then.


- `4132 &lt;https://github.com/pytest-dev/pytest/issues/4132&gt;`_: Fix duplicate printing of internal errors when using ``--pdb``.


- `4135 &lt;https://github.com/pytest-dev/pytest/issues/4135&gt;`_: pathlib based tmpdir cleanup now correctly handles symlinks in the folder.


- `4152 &lt;https://github.com/pytest-dev/pytest/issues/4152&gt;`_: Display the filename when encountering ``SyntaxWarning``.



Improved Documentation
----------------------

- `3713 &lt;https://github.com/pytest-dev/pytest/issues/3713&gt;`_: Update usefixtures documentation to clarify that it can&#39;t be used with fixture functions.


- `4058 &lt;https://github.com/pytest-dev/pytest/issues/4058&gt;`_: Update fixture documentation to specify that a fixture can be invoked twice in the scope it&#39;s defined for.


- `4064 &lt;https://github.com/pytest-dev/pytest/issues/4064&gt;`_: According to unittest.rst, setUpModule and tearDownModule were not implemented, but it turns out they are. So updated the documentation for unittest.


- `4151 &lt;https://github.com/pytest-dev/pytest/issues/4151&gt;`_: Add tempir testing example to CONTRIBUTING.rst guide



Trivial/Internal Changes
------------------------

- `2293 &lt;https://github.com/pytest-dev/pytest/issues/2293&gt;`_: The internal ``MarkerError`` exception has been removed.


- `3988 &lt;https://github.com/pytest-dev/pytest/issues/3988&gt;`_: Port the implementation of tmpdir to pathlib.


- `4063 &lt;https://github.com/pytest-dev/pytest/issues/4063&gt;`_: Exclude 0.00 second entries from ``--duration`` output unless ``-vv`` is passed on the command-line.


- `4093 &lt;https://github.com/pytest-dev/pytest/issues/4093&gt;`_: Fixed formatting of string literals in internal tests.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pytest
  - Changelog: https://pyup.io/changelogs/pytest/
  - Homepage: https://docs.pytest.org/en/latest/
</details>

bors bot added a commit to rehandalal/therapist that referenced this pull request Oct 30, 2018

Merge #43
43: Update pytest to 3.9.3 r=rehandalal a=pyup-bot


This PR updates [pytest](https://pypi.org/project/pytest) from **3.8.2** to **3.9.3**.



<details>
  <summary>Changelog</summary>
  
  
   ### 3.9.3
   ```
   =========================

Bug Fixes
---------

- `4174 &lt;https://github.com/pytest-dev/pytest/issues/4174&gt;`_: Fix &quot;ValueError: Plugin already registered&quot; with conftest plugins via symlink.


- `4181 &lt;https://github.com/pytest-dev/pytest/issues/4181&gt;`_: Handle race condition between creation and deletion of temporary folders.


- `4221 &lt;https://github.com/pytest-dev/pytest/issues/4221&gt;`_: Fix bug where the warning summary at the end of the test session was not showing the test where the warning was originated.


- `4243 &lt;https://github.com/pytest-dev/pytest/issues/4243&gt;`_: Fix regression when ``stacklevel`` for warnings was passed as positional argument on python2.



Improved Documentation
----------------------

- `3851 &lt;https://github.com/pytest-dev/pytest/issues/3851&gt;`_: Add reference to ``empty_parameter_set_mark`` ini option in documentation of ``pytest.mark.parametrize``



Trivial/Internal Changes
------------------------

- `4028 &lt;https://github.com/pytest-dev/pytest/issues/4028&gt;`_: Revert patching of ``sys.breakpointhook`` since it appears to do nothing.


- `4233 &lt;https://github.com/pytest-dev/pytest/issues/4233&gt;`_: Apply an import sorter (``reorder-python-imports``) to the codebase.


- `4248 &lt;https://github.com/pytest-dev/pytest/issues/4248&gt;`_: Remove use of unnecessary compat shim, six.binary_type
   ```
   
  
  
   ### 3.9.2
   ```
   =========================

Bug Fixes
---------

- `2909 &lt;https://github.com/pytest-dev/pytest/issues/2909&gt;`_: Improve error message when a recursive dependency between fixtures is detected.


- `3340 &lt;https://github.com/pytest-dev/pytest/issues/3340&gt;`_: Fix logging messages not shown in hooks ``pytest_sessionstart()`` and ``pytest_sessionfinish()``.


- `3533 &lt;https://github.com/pytest-dev/pytest/issues/3533&gt;`_: Fix unescaped XML raw objects in JUnit report for skipped tests


- `3691 &lt;https://github.com/pytest-dev/pytest/issues/3691&gt;`_: Python 2: safely format warning message about passing unicode strings to ``warnings.warn``, which may cause
  surprising ``MemoryError`` exception when monkey patching ``warnings.warn`` itself.


- `4026 &lt;https://github.com/pytest-dev/pytest/issues/4026&gt;`_: Improve error message when it is not possible to determine a function&#39;s signature.


- `4177 &lt;https://github.com/pytest-dev/pytest/issues/4177&gt;`_: Pin ``setuptools&gt;=40.0`` to support ``py_modules`` in ``setup.cfg``


- `4179 &lt;https://github.com/pytest-dev/pytest/issues/4179&gt;`_: Restore the tmpdir behaviour of symlinking the current test run.


- `4192 &lt;https://github.com/pytest-dev/pytest/issues/4192&gt;`_: Fix filename reported by ``warnings.warn`` when using ``recwarn`` under python2.
   ```
   
  
  
   ### 3.9.1
   ```
   =========================

Features
--------

- `4159 &lt;https://github.com/pytest-dev/pytest/issues/4159&gt;`_: For test-suites containing test classes, the information about the subclassed
  module is now output only if a higher verbosity level is specified (at least
  &quot;-vv&quot;).
   ```
   
  
  
   ### 3.9.0
   ```
   =========================================================================

Deprecations
------------

- `3616 &lt;https://github.com/pytest-dev/pytest/issues/3616&gt;`_: The following accesses have been documented as deprecated for years, but are now actually emitting deprecation warnings.

  * Access of ``Module``, ``Function``, ``Class``, ``Instance``, ``File`` and ``Item`` through ``Node`` instances. Now
    users will this warning::

          usage of Function.Module is deprecated, please use pytest.Module instead

    Users should just ``import pytest`` and access those objects using the ``pytest`` module.

  * ``request.cached_setup``, this was the precursor of the setup/teardown mechanism available to fixtures. You can
    consult `funcarg comparison section in the docs &lt;https://docs.pytest.org/en/latest/funcarg_compare.html&gt;`_.

  * Using objects named ``&quot;Class&quot;`` as a way to customize the type of nodes that are collected in ``Collector``
    subclasses has been deprecated. Users instead should use ``pytest_collect_make_item`` to customize node types during
    collection.

    This issue should affect only advanced plugins who create new collection types, so if you see this warning
    message please contact the authors so they can change the code.

  * The warning that produces the message below has changed to ``RemovedInPytest4Warning``::

          getfuncargvalue is deprecated, use getfixturevalue


- `3988 &lt;https://github.com/pytest-dev/pytest/issues/3988&gt;`_: Add a Deprecation warning for pytest.ensuretemp as it was deprecated since a while.



Features
--------

- `2293 &lt;https://github.com/pytest-dev/pytest/issues/2293&gt;`_: Improve usage errors messages by hiding internal details which can be distracting and noisy.

  This has the side effect that some error conditions that previously raised generic errors (such as
  ``ValueError`` for unregistered marks) are now raising ``Failed`` exceptions.


- `3332 &lt;https://github.com/pytest-dev/pytest/issues/3332&gt;`_: Improve the error displayed when a ``conftest.py`` file could not be imported.

  In order to implement this, a new ``chain`` parameter was added to ``ExceptionInfo.getrepr``
  to show or hide chained tracebacks in Python 3 (defaults to ``True``).


- `3849 &lt;https://github.com/pytest-dev/pytest/issues/3849&gt;`_: Add ``empty_parameter_set_mark=fail_at_collect`` ini option for raising an exception when parametrize collects an empty set.


- `3964 &lt;https://github.com/pytest-dev/pytest/issues/3964&gt;`_: Log messages generated in the collection phase are shown when
  live-logging is enabled and/or when they are logged to a file.


- `3985 &lt;https://github.com/pytest-dev/pytest/issues/3985&gt;`_: Introduce ``tmp_path`` as a fixture providing a Path object.


- `4013 &lt;https://github.com/pytest-dev/pytest/issues/4013&gt;`_: Deprecation warnings are now shown even if you customize the warnings filters yourself. In the previous version
  any customization would override pytest&#39;s filters and deprecation warnings would fall back to being hidden by default.


- `4073 &lt;https://github.com/pytest-dev/pytest/issues/4073&gt;`_: Allow specification of timeout for ``Testdir.runpytest_subprocess()`` and ``Testdir.run()``.


- `4098 &lt;https://github.com/pytest-dev/pytest/issues/4098&gt;`_: Add returncode argument to pytest.exit() to exit pytest with a specific return code.


- `4102 &lt;https://github.com/pytest-dev/pytest/issues/4102&gt;`_: Reimplement ``pytest.deprecated_call`` using ``pytest.warns`` so it supports the ``match=&#39;...&#39;`` keyword argument.

  This has the side effect that ``pytest.deprecated_call`` now raises ``pytest.fail.Exception`` instead
  of ``AssertionError``.


- `4149 &lt;https://github.com/pytest-dev/pytest/issues/4149&gt;`_: Require setuptools&gt;=30.3 and move most of the metadata to ``setup.cfg``.



Bug Fixes
---------

- `2535 &lt;https://github.com/pytest-dev/pytest/issues/2535&gt;`_: Improve error message when test functions of ``unittest.TestCase`` subclasses use a parametrized fixture.


- `3057 &lt;https://github.com/pytest-dev/pytest/issues/3057&gt;`_: ``request.fixturenames`` now correctly returns the name of fixtures created by ``request.getfixturevalue()``.


- `3946 &lt;https://github.com/pytest-dev/pytest/issues/3946&gt;`_: Warning filters passed as command line options using ``-W`` now take precedence over filters defined in ``ini``
  configuration files.


- `4066 &lt;https://github.com/pytest-dev/pytest/issues/4066&gt;`_: Fix source reindenting by using ``textwrap.dedent`` directly.


- `4102 &lt;https://github.com/pytest-dev/pytest/issues/4102&gt;`_: ``pytest.warn`` will capture previously-warned warnings in Python 2. Previously they were never raised.


- `4108 &lt;https://github.com/pytest-dev/pytest/issues/4108&gt;`_: Resolve symbolic links for args.

  This fixes running ``pytest tests/test_foo.py::test_bar``, where ``tests``
  is a symlink to ``project/app/tests``:
  previously ``project/app/conftest.py`` would be ignored for fixtures then.


- `4132 &lt;https://github.com/pytest-dev/pytest/issues/4132&gt;`_: Fix duplicate printing of internal errors when using ``--pdb``.


- `4135 &lt;https://github.com/pytest-dev/pytest/issues/4135&gt;`_: pathlib based tmpdir cleanup now correctly handles symlinks in the folder.


- `4152 &lt;https://github.com/pytest-dev/pytest/issues/4152&gt;`_: Display the filename when encountering ``SyntaxWarning``.



Improved Documentation
----------------------

- `3713 &lt;https://github.com/pytest-dev/pytest/issues/3713&gt;`_: Update usefixtures documentation to clarify that it can&#39;t be used with fixture functions.


- `4058 &lt;https://github.com/pytest-dev/pytest/issues/4058&gt;`_: Update fixture documentation to specify that a fixture can be invoked twice in the scope it&#39;s defined for.


- `4064 &lt;https://github.com/pytest-dev/pytest/issues/4064&gt;`_: According to unittest.rst, setUpModule and tearDownModule were not implemented, but it turns out they are. So updated the documentation for unittest.


- `4151 &lt;https://github.com/pytest-dev/pytest/issues/4151&gt;`_: Add tempir testing example to CONTRIBUTING.rst guide



Trivial/Internal Changes
------------------------

- `2293 &lt;https://github.com/pytest-dev/pytest/issues/2293&gt;`_: The internal ``MarkerError`` exception has been removed.


- `3988 &lt;https://github.com/pytest-dev/pytest/issues/3988&gt;`_: Port the implementation of tmpdir to pathlib.


- `4063 &lt;https://github.com/pytest-dev/pytest/issues/4063&gt;`_: Exclude 0.00 second entries from ``--duration`` output unless ``-vv`` is passed on the command-line.


- `4093 &lt;https://github.com/pytest-dev/pytest/issues/4093&gt;`_: Fixed formatting of string literals in internal tests.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pytest
  - Changelog: https://pyup.io/changelogs/pytest/
  - Homepage: https://docs.pytest.org/en/latest/
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment