Skip to content

Commit

Permalink
Updating bundled pytest-openfiles to v0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bsipocz committed Feb 20, 2019
1 parent 53f3974 commit 51ca821
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,8 @@ Other Changes and Additions
- Fixed ``make clean`` for the documentation on Windows to ensure it
properly removes the ``api`` and ``generated`` directories. [#8346]

- Updating bundled ``pytest-openfiles`` to v0.3.2. [#8434]



2.0.11 (2018-12-31)
Expand Down
13 changes: 12 additions & 1 deletion astropy/extern/plugins/pytest_openfiles/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import imp
import os

from distutils.version import StrictVersion

import pytest

try:
import importlib.machinery as importlib_machinery
except ImportError:
Expand Down Expand Up @@ -56,9 +60,16 @@ def _get_open_file_list():


def pytest_runtest_setup(item):

# Retain backwards compatibility with earlier versions of pytest
if StrictVersion(pytest.__version__) < StrictVersion("3.6"):
ignore = item.get_marker('openfiles_ignore')
else:
ignore = item.get_closest_marker('openfiles_ignore')

# Store a list of the currently opened files so we can compare
# against them when the test is done.
if item.config.getvalue('open_files') and not item.get_marker('openfiles_ignore'):
if item.config.getvalue('open_files') and not ignore:
item.open_files = _get_open_file_list()


Expand Down

0 comments on commit 51ca821

Please sign in to comment.