pytest-openfiles-0.4.0/0000755000077000000240000000000013514611031014736 5ustar tomstaff00000000000000pytest-openfiles-0.4.0/.gitignore0000644000077000000240000000112613514610673016741 0ustar tomstaff00000000000000# Compiled files *.py[cod] *.a *.o *.so *.pyd __pycache__ # Ignore .c files by default to avoid including generated code. If you want to # add a non-generated .c extension, use `git add -f filename.c`. *.c # Other generated files MANIFEST # Sphinx _build _generated docs/api docs/generated # Packages/installer info *.egg *.egg-info dist build eggs .eggs parts bin var sdist develop-eggs .installed.cfg distribute-*.tar.gz # Other .cache .tox .*.swp .*.swo *~ .project .pydevproject .settings .coverage cover htmlcov # Generated by Pytest v .pytest_cache # Mac OSX .DS_Store # PyCharm .idea pytest-openfiles-0.4.0/.travis.yml0000644000077000000240000000245113514610673017064 0ustar tomstaff00000000000000# We set the language to c because python isn't supported on the MacOS X nodes # on Travis. However, the language ends up being irrelevant anyway, since we # install Python ourselves using conda. language: c os: - linux # Use Travis' container-based architecture sudo: false env: global: # The following versions are the 'default' for tests, unless # overidden underneath. They are defined here in order to save having # to repeat them for all configurations. - PYTHON_VERSION=3.6 - PYTEST_VERSION=3.6 - PYTEST_COMMAND='pytest' - NUMPY_VERSION=stable - CONDA_DEPENDENCIES='six' matrix: - PYTHON_VERSION=2.7 PYTEST_VERSION=2.8 PYTEST_COMMAND='py.test' - PYTHON_VERSION=2.7 - PYTHON_VERSION=3.5 - PYTHON_VERSION=3.6 PYTEST_VERSION=3.4 - PYTHON_VERSION=3.6 PYTEST_VERSION=3.5 - PYTHON_VERSION=3.6 - PYTHON_VERSION=3.7 matrix: include: # Try a run on OSX with latest versions of python and pytest - os: osx env: PYTHON_VERSION=3.7 PYTEST_VERSION=3.7 install: - git clone git://github.com/astropy/ci-helpers.git - source ci-helpers/travis/setup_conda.sh - python ./setup.py install script: - $PYTEST_COMMAND - $PYTEST_COMMAND --open-files pytest-openfiles-0.4.0/CHANGES.rst0000644000077000000240000000130013514610735016544 0ustar tomstaff000000000000000.4 (2019-07-20) ================ - Added the ability to use ``*`` and ``?`` wildcards in ``open_files_ignore``. [#22] - Fixed compatibility with pytest 4.2. [#20] 0.3.2 (2019-01-07) ================== - Replace deprecated method to allow for compatibility with ``pytest-4.1`` and later. [#19] 0.3.1 (2018-11-26) ================== - Fix a minor packaging issue. [#13] 0.3.0 (2018-04-20) ================== - Add decorator to skip detection of open files for particular tests. [#10] - Fix packaging error: do not include tests in package distribution. [#11] 0.2 (2017-12-07) ================ - Remove test dependency on astropy. [#4] 0.1 (2017-10-09) ================ - Alpha release. pytest-openfiles-0.4.0/LICENSE.rst0000644000077000000240000000273013207113556016564 0ustar tomstaff00000000000000Copyright (c) 2011-2017, Astropy Developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Astropy Team nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. pytest-openfiles-0.4.0/MANIFEST.in0000644000077000000240000000020313514610673016502 0ustar tomstaff00000000000000include LICENSE.rst include README.rst include CHANGES.rst include setup.cfg recursive-include tests * global-exclude *.pyc *.o pytest-openfiles-0.4.0/PKG-INFO0000644000077000000240000001234713514611031016042 0ustar tomstaff00000000000000Metadata-Version: 1.2 Name: pytest-openfiles Version: 0.4.0 Summary: Pytest plugin for detecting inadvertent open file handles Home-page: https://astropy.org Author: The Astropy Developers Author-email: astropy.team@gmail.com License: BSD Description: ================ pytest-openfiles ================ This package provides a plugin for the `pytest`_ framework that allows developers to detect whether any file handles or other file-like objects were inadvertently left open at the end of a unit test. It has been moved from the core `astropy`_ project since it is of use more generally. .. _pytest: https://pytest.org/en/latest/ .. _astropy: https://astropy.org/en/latest/ **NOTE**: This plugin is not supported with Py2.7 on Win32 platforms. Motivation ---------- The `pytest-openfiles`_ plugin allows for the detection of open I/O resources at the end of unit tests. This is particularly useful for testing code that manipulates file handles or other I/O resources. It allows developers to ensure that this kind of code properly cleans up I/O resources when they are no longer needed. Installation ------------ The ``pytest-openfiles`` plugin can be installed using ``pip``:: $ pip install pytest-openfiles It is also possible to install the latest development version from the source repository:: $ git clone https://github.com/astropy/pytest-openfiles $ cd pytest-openfiles $ python ./setup.py install In either case, the plugin will automatically be registered for use with ``pytest``. Usage ----- This plugin adds the ``--open-files`` option to the ``pytest`` command. When running tests with ``--open-files``, if a file is opened during the course of a unit test but that file is not closed before the test finishes, the test will fail. In some cases certain files are expected to remain open between tests. In order to prevent these files from causing tests to fail, they can be ignored using the configuration file variable ``open_files_ignore``. This variable is added to the ``[tool:pytest]`` section of a package's top-level ``setup.cfg`` file. Files can be ignored using a fully specified filename:: [tool:pytest] open_files_ignore = "/home/user/monty/output.log" It is also possible to ignore files with a particular name regardless of where they reside in the file system:: [tool:pytest] open_files_ignore = "output.log" In this example, all files named ``output.log`` will be ignored if they are found to remain open after a test completes. Paths and filenames can include ``*`` and ``?`` as wildcards:: [tool:pytest] open_files_ignore = "*.ttf" It is also possible to ignore open files for particular test cases by decorating them with the ``openfiles_ignore`` decorator: .. code:: import pytest @pytest.mark.openfiles_ignore def test_open_file_and_ignore(): """We want to ignore this test when checking for open file handles.""" The test function will not be skipped, but any files that are left open by the test will be ignored by this plugin. Development Status ------------------ .. image:: https://travis-ci.org/astropy/pytest-openfile.svg :target: https://travis-ci.org/astropy/pytest-openfiles :alt: Travis CI Status .. image:: https://ci.appveyor.com/api/projects/status/944gtt7n0o1d6826/branch/master?svg=true :target: https://ci.appveyor.com/project/Astropy/pytest-openfiles/branch/master :alt: Appveyor Status Questions, bug reports, and feature requests can be submitted on `github`_. .. _github: https://github.com/astropy/pytest-openfiles License ------- This plugin is licensed under a 3-clause BSD style license - see the ``LICENSE.rst`` file. Keywords: detect,open,file,handle,psutil,pytest,py.test Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Framework :: Pytest Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Topic :: Software Development :: Testing Classifier: Topic :: Utilities Requires-Python: >=2.7 pytest-openfiles-0.4.0/README.rst0000644000077000000240000000655613514610673016454 0ustar tomstaff00000000000000================ pytest-openfiles ================ This package provides a plugin for the `pytest`_ framework that allows developers to detect whether any file handles or other file-like objects were inadvertently left open at the end of a unit test. It has been moved from the core `astropy`_ project since it is of use more generally. .. _pytest: https://pytest.org/en/latest/ .. _astropy: https://astropy.org/en/latest/ **NOTE**: This plugin is not supported with Py2.7 on Win32 platforms. Motivation ---------- The `pytest-openfiles`_ plugin allows for the detection of open I/O resources at the end of unit tests. This is particularly useful for testing code that manipulates file handles or other I/O resources. It allows developers to ensure that this kind of code properly cleans up I/O resources when they are no longer needed. Installation ------------ The ``pytest-openfiles`` plugin can be installed using ``pip``:: $ pip install pytest-openfiles It is also possible to install the latest development version from the source repository:: $ git clone https://github.com/astropy/pytest-openfiles $ cd pytest-openfiles $ python ./setup.py install In either case, the plugin will automatically be registered for use with ``pytest``. Usage ----- This plugin adds the ``--open-files`` option to the ``pytest`` command. When running tests with ``--open-files``, if a file is opened during the course of a unit test but that file is not closed before the test finishes, the test will fail. In some cases certain files are expected to remain open between tests. In order to prevent these files from causing tests to fail, they can be ignored using the configuration file variable ``open_files_ignore``. This variable is added to the ``[tool:pytest]`` section of a package's top-level ``setup.cfg`` file. Files can be ignored using a fully specified filename:: [tool:pytest] open_files_ignore = "/home/user/monty/output.log" It is also possible to ignore files with a particular name regardless of where they reside in the file system:: [tool:pytest] open_files_ignore = "output.log" In this example, all files named ``output.log`` will be ignored if they are found to remain open after a test completes. Paths and filenames can include ``*`` and ``?`` as wildcards:: [tool:pytest] open_files_ignore = "*.ttf" It is also possible to ignore open files for particular test cases by decorating them with the ``openfiles_ignore`` decorator: .. code:: import pytest @pytest.mark.openfiles_ignore def test_open_file_and_ignore(): """We want to ignore this test when checking for open file handles.""" The test function will not be skipped, but any files that are left open by the test will be ignored by this plugin. Development Status ------------------ .. image:: https://travis-ci.org/astropy/pytest-openfile.svg :target: https://travis-ci.org/astropy/pytest-openfiles :alt: Travis CI Status .. image:: https://ci.appveyor.com/api/projects/status/944gtt7n0o1d6826/branch/master?svg=true :target: https://ci.appveyor.com/project/Astropy/pytest-openfiles/branch/master :alt: Appveyor Status Questions, bug reports, and feature requests can be submitted on `github`_. .. _github: https://github.com/astropy/pytest-openfiles License ------- This plugin is licensed under a 3-clause BSD style license - see the ``LICENSE.rst`` file. pytest-openfiles-0.4.0/appveyor.yml0000644000077000000240000000244313514610673017344 0ustar tomstaff00000000000000# AppVeyor.com is a Continuous Integration service to build and run tests under # Windows environment: global: PYTHON: "C:\\conda" MINICONDA_VERSION: "latest" CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers\\appveyor\\windows_sdk.cmd" PYTEST_VERSION: "3.6" PYTEST_COMMAND: "pytest" NUMPY_VERSION: "stable" CONDA_DEPENDENCIES: "six" PYTHON_ARCH: "64" matrix: - PYTHON_VERSION: "2.7" PYTEST_VESION: "2.8" PYTEST_COMMAND: "py.test" platform: x64 - PYTHON_VERSION: "2.7" platform: x64 - PYTHON_VERSION: "3.5" NUMPY_VERSION: "1.15" platform: x64 - PYTHON_VERSION: "3.6" PYTEST_VERSION: "3.4" platform: x64 - PYTHON_VERSION: "3.6" PYTEST_VERSION: "3.5" platform: x64 - PYTHON_VERSION: "3.6" platform: x86 - PYTHON_VERSION: "3.7" platform: x64 install: - "git clone git://github.com/astropy/ci-helpers.git" - "powershell ci-helpers/appveyor/install-miniconda.ps1" - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - "activate test" - "%CMD_IN_ENV% python setup.py install" # Not a .NET project build: false test_script: - "%CMD_IN_ENV% %PYTEST_COMMAND%" - "%CMD_IN_ENV% %PYTEST_COMMAND% --open-files" pytest-openfiles-0.4.0/pytest_openfiles/0000755000077000000240000000000013514611031020332 5ustar tomstaff00000000000000pytest-openfiles-0.4.0/pytest_openfiles/__init__.py0000644000077000000240000000022613207113556022453 0ustar tomstaff00000000000000# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package contains pytest plugins that are used by the astropy test suite. """ pytest-openfiles-0.4.0/pytest_openfiles/plugin.py0000644000077000000240000000772513514610673022230 0ustar tomstaff00000000000000# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This plugin provides support for testing whether file-like objects are properly closed. """ import os import fnmatch from distutils.version import LooseVersion import pytest try: import importlib.machinery as importlib_machinery except ImportError: import imp importlib_machinery = None _pytest_36 = LooseVersion(pytest.__version__) >= LooseVersion("3.6") def pytest_addoption(parser): parser.addoption("--open-files", action="store_true", help="fail if any test leaves files open") parser.addini("open_files_ignore", "when used with the --open-files option, allows " "specifying names of files that may be ignored when " "left open between tests--files in this list are matched " "may be specified by their base name (ignoring their full " "path) or by absolute path", type="args", default=()) def pytest_configure(config): config.getini('markers').append( 'openfiles_ignore: Indicate that open files should be ignored for this test') # Open file detection. # # This works by calling out to psutil to get the list of open files # held by the process both before and after the test. If something is # still open after the test that wasn't open before the test, an # AssertionError is raised. # # This is not thread-safe. We're not currently running our tests # multi-threaded, but that is worth noting. def _get_open_file_list(): import psutil files = [] p = psutil.Process() if importlib_machinery is not None: suffixes = tuple(importlib_machinery.all_suffixes()) else: suffixes = tuple(info[0] for info in imp.get_suffixes()) files = [x.path for x in p.open_files() if not x.path.endswith(suffixes)] return set(files) def pytest_runtest_setup(item): # 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'): # Retain backwards compatibility with earlier versions of pytest if _pytest_36: ignore = item.get_closest_marker('openfiles_ignore') else: ignore = item.get_marker('openfiles_ignore') if not ignore: item.open_files = _get_open_file_list() def pytest_runtest_teardown(item, nextitem): # a "skipped" test will not have been called with # pytest_runtest_setup, so therefore won't have an # "open_files" member if (not item.config.getvalue('open_files') or not hasattr(item, 'open_files')): return start_open_files = item.open_files del item.open_files open_files = _get_open_file_list() # This works in tandem with the test_open_file_detection test to # ensure that it creates one extra open file. if item.name == 'test_open_file_detection': assert len(start_open_files) + 1 == len(open_files) return not_closed = set() open_files_ignore = item.config.getini('open_files_ignore') for filename in open_files: ignore = False for ignored in open_files_ignore: # Note that we use fnmatch rather than re for simplicity since # we are dealing with file paths - fnmatch works with the standard # * and ? wildcards in paths. if not os.path.isabs(ignored): # Since the path is not absolute, we convert it to # */ to make sure it matches absolute paths. ignored = os.path.join('*', ignored) if fnmatch.fnmatch(filename, ignored): ignore = True break if ignore: continue if filename not in start_open_files: not_closed.add(filename) if len(not_closed): msg = ['File(s) not closed:'] for name in not_closed: msg.append(' {0}'.format(name)) raise AssertionError('\n'.join(msg)) pytest-openfiles-0.4.0/pytest_openfiles.egg-info/0000755000077000000240000000000013514611031022024 5ustar tomstaff00000000000000pytest-openfiles-0.4.0/pytest_openfiles.egg-info/PKG-INFO0000644000077000000240000001234713514611031023130 0ustar tomstaff00000000000000Metadata-Version: 1.2 Name: pytest-openfiles Version: 0.4.0 Summary: Pytest plugin for detecting inadvertent open file handles Home-page: https://astropy.org Author: The Astropy Developers Author-email: astropy.team@gmail.com License: BSD Description: ================ pytest-openfiles ================ This package provides a plugin for the `pytest`_ framework that allows developers to detect whether any file handles or other file-like objects were inadvertently left open at the end of a unit test. It has been moved from the core `astropy`_ project since it is of use more generally. .. _pytest: https://pytest.org/en/latest/ .. _astropy: https://astropy.org/en/latest/ **NOTE**: This plugin is not supported with Py2.7 on Win32 platforms. Motivation ---------- The `pytest-openfiles`_ plugin allows for the detection of open I/O resources at the end of unit tests. This is particularly useful for testing code that manipulates file handles or other I/O resources. It allows developers to ensure that this kind of code properly cleans up I/O resources when they are no longer needed. Installation ------------ The ``pytest-openfiles`` plugin can be installed using ``pip``:: $ pip install pytest-openfiles It is also possible to install the latest development version from the source repository:: $ git clone https://github.com/astropy/pytest-openfiles $ cd pytest-openfiles $ python ./setup.py install In either case, the plugin will automatically be registered for use with ``pytest``. Usage ----- This plugin adds the ``--open-files`` option to the ``pytest`` command. When running tests with ``--open-files``, if a file is opened during the course of a unit test but that file is not closed before the test finishes, the test will fail. In some cases certain files are expected to remain open between tests. In order to prevent these files from causing tests to fail, they can be ignored using the configuration file variable ``open_files_ignore``. This variable is added to the ``[tool:pytest]`` section of a package's top-level ``setup.cfg`` file. Files can be ignored using a fully specified filename:: [tool:pytest] open_files_ignore = "/home/user/monty/output.log" It is also possible to ignore files with a particular name regardless of where they reside in the file system:: [tool:pytest] open_files_ignore = "output.log" In this example, all files named ``output.log`` will be ignored if they are found to remain open after a test completes. Paths and filenames can include ``*`` and ``?`` as wildcards:: [tool:pytest] open_files_ignore = "*.ttf" It is also possible to ignore open files for particular test cases by decorating them with the ``openfiles_ignore`` decorator: .. code:: import pytest @pytest.mark.openfiles_ignore def test_open_file_and_ignore(): """We want to ignore this test when checking for open file handles.""" The test function will not be skipped, but any files that are left open by the test will be ignored by this plugin. Development Status ------------------ .. image:: https://travis-ci.org/astropy/pytest-openfile.svg :target: https://travis-ci.org/astropy/pytest-openfiles :alt: Travis CI Status .. image:: https://ci.appveyor.com/api/projects/status/944gtt7n0o1d6826/branch/master?svg=true :target: https://ci.appveyor.com/project/Astropy/pytest-openfiles/branch/master :alt: Appveyor Status Questions, bug reports, and feature requests can be submitted on `github`_. .. _github: https://github.com/astropy/pytest-openfiles License ------- This plugin is licensed under a 3-clause BSD style license - see the ``LICENSE.rst`` file. Keywords: detect,open,file,handle,psutil,pytest,py.test Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Framework :: Pytest Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Topic :: Software Development :: Testing Classifier: Topic :: Utilities Requires-Python: >=2.7 pytest-openfiles-0.4.0/pytest_openfiles.egg-info/SOURCES.txt0000644000077000000240000000101513514611031023705 0ustar tomstaff00000000000000.gitignore .travis.yml CHANGES.rst LICENSE.rst MANIFEST.in README.rst appveyor.yml setup.cfg setup.py pytest_openfiles/__init__.py pytest_openfiles/plugin.py pytest_openfiles.egg-info/PKG-INFO pytest_openfiles.egg-info/SOURCES.txt pytest_openfiles.egg-info/dependency_links.txt pytest_openfiles.egg-info/entry_points.txt pytest_openfiles.egg-info/not-zip-safe pytest_openfiles.egg-info/requires.txt pytest_openfiles.egg-info/top_level.txt tests/__init__.py tests/test_open_file_detection.py tests/data/open_file_detection.txtpytest-openfiles-0.4.0/pytest_openfiles.egg-info/dependency_links.txt0000644000077000000240000000000113514611031026072 0ustar tomstaff00000000000000 pytest-openfiles-0.4.0/pytest_openfiles.egg-info/entry_points.txt0000644000077000000240000000006713514611031025325 0ustar tomstaff00000000000000[pytest11] pytest_openfiles = pytest_openfiles.plugin pytest-openfiles-0.4.0/pytest_openfiles.egg-info/not-zip-safe0000644000077000000240000000000113514611031024252 0ustar tomstaff00000000000000 pytest-openfiles-0.4.0/pytest_openfiles.egg-info/requires.txt0000644000077000000240000000002513514611031024421 0ustar tomstaff00000000000000pytest>=2.8.0 psutil pytest-openfiles-0.4.0/pytest_openfiles.egg-info/top_level.txt0000644000077000000240000000002113514611031024547 0ustar tomstaff00000000000000pytest_openfiles pytest-openfiles-0.4.0/setup.cfg0000644000077000000240000000230513514611031016557 0ustar tomstaff00000000000000[metadata] name = pytest-openfiles version = 0.4.0 url = https://astropy.org author = The Astropy Developers author_email = astropy.team@gmail.com classifiers = Development Status :: 3 - Alpha Framework :: Pytest Intended Audience :: Developers License :: OSI Approved :: BSD License Operating System :: OS Independent Programming Language :: Python Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.3 Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: Implementation :: CPython Topic :: Software Development :: Testing Topic :: Utilities license = BSD description = Pytest plugin for detecting inadvertent open file handles long_description = file: README.rst keywords = detect, open, file, handle, psutil, pytest, py.test [options] zip_safe = False packages = find: python_requires = >=2.7 install_requires = pytest>=2.8.0 psutil [options.entry_points] pytest11 = pytest_openfiles = pytest_openfiles.plugin [options.packages.find] exclude = tests [tool:pytest] minversion = 2.8 testpaths = tests [egg_info] tag_build = tag_date = 0 pytest-openfiles-0.4.0/setup.py0000755000077000000240000000067013513225151016461 0ustar tomstaff00000000000000#!/usr/bin/env python import sys import setuptools from distutils.version import LooseVersion from setuptools import setup # Setuptools 30.3.0 or later is needed for setup.cfg options to be used if LooseVersion(setuptools.__version__) < LooseVersion('30.3.0'): sys.stderr.write("ERROR: sphinx-automodapi requires setuptools 30.3.0 or " "later (found {0})".format(setuptools.__version__)) sys.exit(1) setup() pytest-openfiles-0.4.0/tests/0000755000077000000240000000000013514611031016100 5ustar tomstaff00000000000000pytest-openfiles-0.4.0/tests/__init__.py0000644000077000000240000000010013207113556020210 0ustar tomstaff00000000000000# Licensed under a 3-clause BSD style license - see LICENSE.rst pytest-openfiles-0.4.0/tests/data/0000755000077000000240000000000013514611031017011 5ustar tomstaff00000000000000pytest-openfiles-0.4.0/tests/data/open_file_detection.txt0000644000077000000240000000001113207113556023550 0ustar tomstaff00000000000000CONTENTS pytest-openfiles-0.4.0/tests/test_open_file_detection.py0000644000077000000240000000073713514610673023531 0ustar tomstaff00000000000000# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import pytest PKG_DATA_DIR = os.path.dirname(__file__) fd = None def test_open_file_detection(): global fd fd = open(os.path.join(PKG_DATA_DIR, 'data/open_file_detection.txt')) @pytest.mark.openfiles_ignore def test_skip_open_file_detection(): global fd fd = open(os.path.join(PKG_DATA_DIR, 'data/open_file_detection.txt')) def teardown(): if fd is not None: fd.close()