pytest-datadir/0000755000175000017500000000000013767431422012755 5ustar becuebecuepytest-datadir/setup.py0000644000175000017500000000315013553577106014471 0ustar becuebecueimport io import re from setuptools import find_packages, setup with io.open('README.md', encoding='UTF-8') as fp: long_description = fp.read() setup( name="pytest-datadir", use_scm_version={"write_to": "src/pytest_datadir/_version.py"}, setup_requires=['setuptools_scm'], packages=find_packages(where="src"), entry_points={ 'pytest11': ['pytest-datadir = pytest_datadir.plugin'], }, package_dir={"": "src"}, install_requires=['pytest>=2.7.0'], data_files = [("", ["LICENSE"])], author='Gabriel Reis', author_email='gabrielcnr@gmail.com', description='pytest plugin for test data directories and files', long_description=long_description, long_description_content_type="text/markdown", license='MIT', keywords='pytest test unittest directory file', extras_require={':python_version<"3.4"': ['pathlib2']}, url='http://github.com/gabrielcnr/pytest-datadir', python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Topic :: Software Development :: Quality Assurance', 'Topic :: Software Development :: Testing', ], ) pytest-datadir/README.md0000644000175000017500000000354613553577106014247 0ustar becuebecue# pytest-datadir pytest plugin for manipulating test data directories and files. [![Build Status](https://travis-ci.org/gabrielcnr/pytest-datadir.svg?branch=master)](https://travis-ci.org/gabrielcnr/pytest-datadir) [![PyPI](https://img.shields.io/pypi/v/pytest-datadir.svg)](https://pypi.python.org/pypi/pytest-datadir) [![PythonVersions](https://img.shields.io/pypi/pyversions/pytest-datadir.svg)](https://pypi.python.org/pypi/pytest-datadir) [![CondaForge](https://img.shields.io/conda/vn/conda-forge/pytest-datadir.svg)](https://anaconda.org/conda-forge/pytest-datadir) # Usage pytest-datadir will look up for a directory with the name of your module or the global 'data' folder. Let's say you have a structure like this: ``` . ├── data/ │   └── hello.txt ├── test_hello/ │   └── spam.txt └── test_hello.py ``` You can access the contents of these files using injected variables `datadir` (for *test_* folder) or `shared_datadir` (for *data* folder): ```python def test_read_global(shared_datadir): contents = (shared_datadir / 'hello.txt').read_text() assert contents == 'Hello World!\n' def test_read_module(datadir): contents = (datadir / 'spam.txt').read_text() assert contents == 'eggs\n' ``` pytest-datadir will copy the original file to a temporary folder, so changing the file contents won't change the original data file. Both `datadir` and `shared_datadir` fixtures are `pathlib.Path` objects. # Releases Follow these steps to make a new release: 1. Create a new branch `release-X.Y.Z` from `master`. 2. Update `CHANGELOG.rst`. 3. Open a PR. 4. After it is **green** and **approved**, push a new tag in the format `X.Y.Z`. Travis will deploy to PyPI automatically. Afterwards, update the recipe in [conda-forge/pytest-datadir-feedstock](https://github.com/conda-forge/pytest-datadir-feedstock). # License MIT. pytest-datadir/CHANGELOG.rst0000644000175000017500000000171213553577106015002 0ustar becuebecuepytest-datadir ============== 1.3.1 (2019-10-22) ------------------ - Add testing for Python 3.7 and 3.8. - Add ``python_requires`` to ``setup.py`` so ``pip`` will not try to install ``pytest-datadir`` in incompatible Python versions. 1.3.0 (2019-01-15) ------------------ - Add support for long path names on Windows (`#25 `__). 1.2.1 (2018-07-12) ------------------ - Fix ``pytest_datadir.version`` attribute to point to the correct version. 1.2.0 (2018-07-11) ------------------ - Use ``pathlib2`` on Python 2.7: this is the proper backport of Python 3's standard library. 1.1.0 (2018-07-10) ------------------ - If the data directory does not exist, the fixture will create an empty directory. 1.0.1 (2017-08-15) ------------------ **Fixes** - Fixed ``shared_datadir`` contents not being copied to a temp location on each test. `#12 `_ pytest-datadir/LICENSE0000644000175000017500000000224513553577106013770 0ustar becuebecueThis is the MIT license: http://www.opensource.org/licenses/mit-license.php Copyright (c) 2015-2016 the pytest-datadir authors and contributors . Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. pytest-datadir/MANIFEST.in0000644000175000017500000000004213553577106014512 0ustar becuebecueinclude LICENSE include README.md pytest-datadir/appveyor.yml0000644000175000017500000000033413553577106015350 0ustar becuebecueinit: - git config --system core.longpaths true install: - C:\Python37\python -m pip install -U pip - C:\Python37\python -m pip install tox build: false test_script: - C:\Python37\scripts\tox skip_tags: true pytest-datadir/PKG-INFO0000644000175000017500000000645613553577125014071 0ustar becuebecueMetadata-Version: 2.1 Name: pytest-datadir Version: 1.3.1 Summary: pytest plugin for test data directories and files Home-page: http://github.com/gabrielcnr/pytest-datadir Author: Gabriel Reis Author-email: gabrielcnr@gmail.com License: MIT Description: # pytest-datadir pytest plugin for manipulating test data directories and files. [![Build Status](https://travis-ci.org/gabrielcnr/pytest-datadir.svg?branch=master)](https://travis-ci.org/gabrielcnr/pytest-datadir) [![PyPI](https://img.shields.io/pypi/v/pytest-datadir.svg)](https://pypi.python.org/pypi/pytest-datadir) [![PythonVersions](https://img.shields.io/pypi/pyversions/pytest-datadir.svg)](https://pypi.python.org/pypi/pytest-datadir) [![CondaForge](https://img.shields.io/conda/vn/conda-forge/pytest-datadir.svg)](https://anaconda.org/conda-forge/pytest-datadir) # Usage pytest-datadir will look up for a directory with the name of your module or the global 'data' folder. Let's say you have a structure like this: ``` . ├── data/ │   └── hello.txt ├── test_hello/ │   └── spam.txt └── test_hello.py ``` You can access the contents of these files using injected variables `datadir` (for *test_* folder) or `shared_datadir` (for *data* folder): ```python def test_read_global(shared_datadir): contents = (shared_datadir / 'hello.txt').read_text() assert contents == 'Hello World!\n' def test_read_module(datadir): contents = (datadir / 'spam.txt').read_text() assert contents == 'eggs\n' ``` pytest-datadir will copy the original file to a temporary folder, so changing the file contents won't change the original data file. Both `datadir` and `shared_datadir` fixtures are `pathlib.Path` objects. # Releases Follow these steps to make a new release: 1. Create a new branch `release-X.Y.Z` from `master`. 2. Update `CHANGELOG.rst`. 3. Open a PR. 4. After it is **green** and **approved**, push a new tag in the format `X.Y.Z`. Travis will deploy to PyPI automatically. Afterwards, update the recipe in [conda-forge/pytest-datadir-feedstock](https://github.com/conda-forge/pytest-datadir-feedstock). # License MIT. Keywords: pytest test unittest directory file Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Software Development :: Quality Assurance Classifier: Topic :: Software Development :: Testing Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* Description-Content-Type: text/markdown pytest-datadir/setup.cfg0000644000175000017500000000010313553577125014574 0ustar becuebecue[bdist_wheel] universal = 1 [egg_info] tag_build = tag_date = 0 pytest-datadir/tests/0000755000175000017500000000000013553577125014123 5ustar becuebecuepytest-datadir/tests/data/0000755000175000017500000000000013553577125015034 5ustar becuebecuepytest-datadir/tests/data/spam.txt0000644000175000017500000000000513553577106016527 0ustar becuebecueeggs pytest-datadir/tests/data/shared_directory/0000755000175000017500000000000013553577125020366 5ustar becuebecuepytest-datadir/tests/data/shared_directory/file.txt0000644000175000017500000000001713553577106022043 0ustar becuebecueglobal contentspytest-datadir/tests/data/over.txt0000644000175000017500000000000513553577106016542 0ustar becuebecue8000 pytest-datadir/tests/test_hello/0000755000175000017500000000000013553577125016265 5ustar becuebecue././@LongLink0000644000000000000000000000043700000000000011607 Lustar rootrootpytest-datadir/tests/test_hello/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txtpytest-datadir/tests/test_hello/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000644000175000017500000001645413553577106033204 0ustar becuebecuePNG  IHDR&IDATxsǕ'WUWw}/Q"%Jd[̿?lxǞxfeZ(R8諪2mx ]/>G(Gዪ*1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1clL uyEQ:Q)%R#zSy6vsB7$6J " (@ަ^{T` g&ky vK9lry"" gv+!ϲԕmy#{z;Rpn禢(y%ܧ"ϳFإj ?_,vnRWjɹJ])|~{,o}o+ys37BFv^y}hE(2}Ovh`%ّ8S7Q{ߗgpj`Ҍqniv_]ͻk?P6O'QGe:vߣ.4q%?Sf ,g;?>;L^jT*R|<j*_ͷ6f+q;7\8$L,6D眝zi7Mvy{neyH]k4\fԕu{:yyMB~t!rUޡ5,zgYo[B~L-B^-,ᲴT?G>_DR6}5wZxmm(W?t2+W yP4Z\짮.rW+eQrBS\|u5 yy5 Tԕ'O&!!8'p<4lWA='||Q`t;_fon BN.yZ#Ue8y:,å 9R(&K-lg^{C g1{FZZ+⫝mJ 僵ENA'u!\dͶcdY暿 0QY <~22\ #D~~."NT^Xe! "cڃGV'˲C2^@VWun>ݽ,'B@aټ3;@^63\|&Z׽j 湾T`EZ7x'vOxuΥOwYQ<|6m4xq[~.1`f1uϡ @|5.噟 Sz aٓA:4痕x;i y3kx2\?ug$^(> 878csr.?ˀ/:뫔%pvpZw{IWJ;w q .\"=]B Pta ..ʎE+)g B e6=6l/8+9*͠ r½BNZkLл8 6Rab{y}>9^8d#;Lw}zAˢ&Y`b yd"P$amO+`*vöRD'4YGpC^  @Czowk<Q6h.0u}G{@  8ǛwHtLqhD;e kL)"i AqV\j7mzPq>vz9.DKG{@F8AraPVҐ\*^@" h$ǚҐ  @@f#8J8!E<2%^w$''Z,ԅӊ VJ\]iݧ<T%"+3FuލE"LW$\#+,GQ <9y8, gH F~6ФF$3a8@#,'BAuUy @QO():P/@RX|5TF= 2Eu_4T^ Hu: !xg) xtrOCiGGJx5NAHV$="v$ qi'DAJ8 CB1!$ȟW.Ƕ}ᨛ)+)ԘܢHEp #$-?8/GJi%%"`yxRܔwS|6"I; 0'@߃oŽW г#o<IOyvxK@ ǧ<1ARIsGu3%e̎~*8EDArZ DZ ssFWQ h}v"^y;)G>- B虑SJVv;GRv(4FP u !]R*RR Eu7nbt($4-- @+BVՍVP(fShPDZʋ !l""K*HDXZUA\D! @j6j@}F!yoK*F璅` Zd#dk9\CPx2VۂU7E(&3!@q7)=t{ @F.%:ɊָM]EaX˄SZ2 @pq> 466!ێЪzf0DFujڙ-TJ25ӨHK]kFHt3u-T36U5lF়HѸ tLf?=HK E]/1]LL7jV}rP_*JG]˻''&Qd`kռ`_ TEK];fs*(G] '7{ +RQnggXl)P[w&@DFAZo0ߨh2 )(tu~.ᄀ^oV2<]bTP'AVfU$\^l&J7QV~P2Ӵ^?r!ԛb-y/f$"\ |kT_Ե.hΓ=GӑRJn^~w&BDv~.ppY#{bK wYu 0\$<ݿ}uܻ>)u")p{M-m@] 2p T:-upc@@+y{Aײvκy?NuベXko˸lKUzhǫ`uu"RJ'Q. :uÝT.TR&u)&ZZ 8:aM):G9׮Լu.m=*W2rKyga&?κ<ւ =;#5ڬ0= H*-C O猷lH|y&B*11k˗&st 3pi0X Sj;6lhE]0rfFh.ZssIRnn;ϔ$/N*.:-|31JkǁvJg{m :L3Qho‹JP/Wz]66 @2URi#ҭ[J2 p1;f'bV24;^\]_Hަ^]D&R ֝|굥@foiLbJbںDĉ)_̇ugvkwwT=zZRRI%|QCT~vR wt'*HeVRH!(JD ;ag6|yn12TU#BiT`\U yٴs?F6hmRB`ۺ;CF:sͪʃx0h0?3Չ1JI) tZI>Ox%~컴HD蜵yn͆ V?87ܰ88J@ýq|C]ZJ4/;Yi;5͙JdKsB vu_2ɋ6yZw`4R(LT"[oH5F@D!z<""GRRJk%({x} MsXK `SCB( < @o^{s|IQ*zyQ%@ gBi1^s1v\s*  <zgn{EX4 D5RR ߟ9,wmjs1$JI!z\e>sc1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1؛rIENDB`pytest-datadir/tests/test_hello/local_directory/0000755000175000017500000000000013553577125021443 5ustar becuebecuepytest-datadir/tests/test_hello/local_directory/file.txt0000644000175000017500000000001613553577106023117 0ustar becuebecuelocal contentspytest-datadir/tests/test_hello/over.txt0000644000175000017500000000000513553577106017773 0ustar becuebecue9000 pytest-datadir/tests/test_hello/hello.txt0000644000175000017500000000001613553577106020125 0ustar becuebecueHello, world! pytest-datadir/tests/test_hello.py0000644000175000017500000000411413553577106016636 0ustar becuebecuefrom __future__ import unicode_literals import os def test_read_hello(datadir): assert set(os.listdir(str(datadir))) == {'local_directory', 'hello.txt', 'over.txt', 'a' * 250 + '.txt'} with (datadir/'hello.txt').open() as fp: contents = fp.read() assert contents == 'Hello, world!\n' def test_change_test_files(datadir, original_datadir, shared_datadir, request): filename = datadir / 'hello.txt' with filename.open('w') as fp: fp.write('Modified text!\n') original_filename = original_datadir / 'hello.txt' with original_filename.open() as fp: assert fp.read() == 'Hello, world!\n' with filename.open() as fp: assert fp.read() == 'Modified text!\n' shared_filename = shared_datadir/'over.txt' with shared_filename.open('w') as fp: fp.write('changed') shared_original = os.path.join(request.fspath.dirname, 'data', 'over.txt') with open(shared_original) as fp: assert fp.read().strip() == '8000' def test_read_spam_from_other_dir(shared_datadir): filename = shared_datadir / 'spam.txt' with filename.open() as fp: contents = fp.read() assert contents == 'eggs\n' def test_file_override(shared_datadir, datadir): """ The same file is in the module dir and global data. Shared files are kept in a different temp directory""" shared_filepath = shared_datadir/'over.txt' private_filepath = datadir/'over.txt' assert shared_filepath.is_file() assert private_filepath.is_file() assert shared_filepath != private_filepath def test_local_directory(datadir): directory = datadir/'local_directory' assert directory.is_dir() filename = directory/'file.txt' assert filename.is_file() with filename.open() as fp: contents = fp.read() assert contents == 'local contents' def test_shared_directory(shared_datadir): assert shared_datadir.is_dir() filename = shared_datadir/'shared_directory'/'file.txt' assert filename.is_file() with filename.open() as fp: contents = fp.read() assert contents == 'global contents' pytest-datadir/tests/test_pathlib.py0000644000175000017500000000055313553577106017161 0ustar becuebecueimport sys import pytest @pytest.mark.skipif(sys.version_info[0] == 3, reason='Python 2 only') def test_correct_pathlib(datadir): """ Dummy test that we are using the correct backport of Python 3's standard pathlib in Python 2. """ (datadir / 'foo').mkdir(parents=True, exist_ok=True) (datadir / 'foo').mkdir(parents=True, exist_ok=True) pytest-datadir/tests/test_nonexistent.py0000644000175000017500000000013413553577106020107 0ustar becuebecue def test_missing_data_dir_starts_empty(datadir): assert list(datadir.iterdir()) == [] pytest-datadir/src/0000755000175000017500000000000013553577125013550 5ustar becuebecuepytest-datadir/src/pytest_datadir.egg-info/0000755000175000017500000000000013553577125020262 5ustar becuebecuepytest-datadir/src/pytest_datadir.egg-info/entry_points.txt0000644000175000017500000000006313553577125023557 0ustar becuebecue[pytest11] pytest-datadir = pytest_datadir.plugin pytest-datadir/src/pytest_datadir.egg-info/requires.txt0000644000175000017500000000006013553577125022656 0ustar becuebecuepytest>=2.7.0 [:python_version<"3.4"] pathlib2 pytest-datadir/src/pytest_datadir.egg-info/PKG-INFO0000644000175000017500000000645613553577125021372 0ustar becuebecueMetadata-Version: 2.1 Name: pytest-datadir Version: 1.3.1 Summary: pytest plugin for test data directories and files Home-page: http://github.com/gabrielcnr/pytest-datadir Author: Gabriel Reis Author-email: gabrielcnr@gmail.com License: MIT Description: # pytest-datadir pytest plugin for manipulating test data directories and files. [![Build Status](https://travis-ci.org/gabrielcnr/pytest-datadir.svg?branch=master)](https://travis-ci.org/gabrielcnr/pytest-datadir) [![PyPI](https://img.shields.io/pypi/v/pytest-datadir.svg)](https://pypi.python.org/pypi/pytest-datadir) [![PythonVersions](https://img.shields.io/pypi/pyversions/pytest-datadir.svg)](https://pypi.python.org/pypi/pytest-datadir) [![CondaForge](https://img.shields.io/conda/vn/conda-forge/pytest-datadir.svg)](https://anaconda.org/conda-forge/pytest-datadir) # Usage pytest-datadir will look up for a directory with the name of your module or the global 'data' folder. Let's say you have a structure like this: ``` . ├── data/ │   └── hello.txt ├── test_hello/ │   └── spam.txt └── test_hello.py ``` You can access the contents of these files using injected variables `datadir` (for *test_* folder) or `shared_datadir` (for *data* folder): ```python def test_read_global(shared_datadir): contents = (shared_datadir / 'hello.txt').read_text() assert contents == 'Hello World!\n' def test_read_module(datadir): contents = (datadir / 'spam.txt').read_text() assert contents == 'eggs\n' ``` pytest-datadir will copy the original file to a temporary folder, so changing the file contents won't change the original data file. Both `datadir` and `shared_datadir` fixtures are `pathlib.Path` objects. # Releases Follow these steps to make a new release: 1. Create a new branch `release-X.Y.Z` from `master`. 2. Update `CHANGELOG.rst`. 3. Open a PR. 4. After it is **green** and **approved**, push a new tag in the format `X.Y.Z`. Travis will deploy to PyPI automatically. Afterwards, update the recipe in [conda-forge/pytest-datadir-feedstock](https://github.com/conda-forge/pytest-datadir-feedstock). # License MIT. Keywords: pytest test unittest directory file Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Software Development :: Quality Assurance Classifier: Topic :: Software Development :: Testing Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* Description-Content-Type: text/markdown pytest-datadir/src/pytest_datadir.egg-info/SOURCES.txt0000644000175000017500000000171313553577125022150 0ustar becuebecue.gitignore .travis.yml AUTHORS CHANGELOG.rst LICENSE MANIFEST.in README.md appveyor.yml setup.cfg setup.py tox.ini src/pytest_datadir/__init__.py src/pytest_datadir/_version.py src/pytest_datadir/plugin.py src/pytest_datadir.egg-info/PKG-INFO src/pytest_datadir.egg-info/SOURCES.txt src/pytest_datadir.egg-info/dependency_links.txt src/pytest_datadir.egg-info/entry_points.txt src/pytest_datadir.egg-info/requires.txt src/pytest_datadir.egg-info/top_level.txt tests/test_hello.py tests/test_nonexistent.py tests/test_pathlib.py tests/data/over.txt tests/data/spam.txt tests/data/shared_directory/file.txt tests/test_hello/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt tests/test_hello/hello.txt tests/test_hello/over.txt tests/test_hello/local_directory/file.txtpytest-datadir/src/pytest_datadir.egg-info/top_level.txt0000644000175000017500000000001713553577125023012 0ustar becuebecuepytest_datadir pytest-datadir/src/pytest_datadir.egg-info/dependency_links.txt0000644000175000017500000000000113553577125024330 0ustar becuebecue pytest-datadir/src/pytest_datadir/0000755000175000017500000000000013553577125016570 5ustar becuebecuepytest-datadir/src/pytest_datadir/plugin.py0000644000175000017500000000266713553577106020452 0ustar becuebecueimport os import shutil import sys if sys.version_info[0] == 2: from pathlib2 import Path else: from pathlib import Path import pytest def _win32_longpath(path): ''' Helper function to add the long path prefix for Windows, so that shutil.copytree won't fail while working with paths with 255+ chars. ''' if sys.platform == 'win32': # The use of os.path.normpath here is necessary since "the "\\?\" prefix to a path string # tells the Windows APIs to disable all string parsing and to send the string that follows # it straight to the file system". # (See https://docs.microsoft.com/pt-br/windows/desktop/FileIO/naming-a-file) return '\\\\?\\' + os.path.normpath(path) else: return path @pytest.fixture def shared_datadir(request, tmpdir): original_shared_path = os.path.join(request.fspath.dirname, 'data') temp_path = Path(str(tmpdir.join('data'))) shutil.copytree(_win32_longpath(original_shared_path), _win32_longpath(str(temp_path))) return temp_path @pytest.fixture def original_datadir(request): return Path(os.path.splitext(request.module.__file__)[0]) @pytest.fixture def datadir(original_datadir, tmpdir): result = Path(str(tmpdir.join(original_datadir.stem))) if original_datadir.is_dir(): shutil.copytree(_win32_longpath(str(original_datadir)), _win32_longpath(str(result))) else: result.mkdir() return result pytest-datadir/src/pytest_datadir/_version.py0000644000175000017500000000016413553577125020767 0ustar becuebecue# coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control version = '1.3.1' pytest-datadir/src/pytest_datadir/__init__.py0000644000175000017500000000024313553577106020677 0ustar becuebecuefrom __future__ import absolute_import try: from ._version import version __version__ = version except ImportError: __version__ = version = 'unknown' pytest-datadir/.travis.yml0000644000175000017500000000250513553577106015073 0ustar becuebecuesudo: false language: python stages: - test - name: deploy if: repo = gabrielcnr/pytest-datadir AND tag IS present python: - "2.7" - "3.4" - "3.5" - "3.6" - "3.7" - "3.8" install: - pip install --upgrade setuptools pip - pip install tox-travis script: tox jobs: include: - stage: deploy python: '3.7' env: install: pip install -U setuptools setuptools_scm script: skip deploy: provider: pypi user: nicoddemus distributions: sdist bdist_wheel skip_upload_docs: true password: secure: JS4D2aJ2WsihjWbkm1/Y1BFEDWO+G+1Zba//jGROkRpO/gBaTC+f9pNUw8J6EhH5313D0cewIwQ20LF98630h7WlfYtQtqyXFqsCt5kXkvfaLel7K3qAzCwBuNIOYhR2tH4OuNyn8ORwmi1yJWSYfxv4Lf8VVatuw8PO3RKKAtv2u8kcWI2+J2dkJ/uDHWIcXxjoKFMgEcI49BxXhfVJa6jLG0E4ayegbALNWfoDS2zi8/pF5FKdMGAZYS9bsqxINAPezWpaRYu7gwrXPbOvY8vsUGBQ5CRXFUL7J+3bbCcLnYoJamiO7OhjGQDCrr0F5UIrdmgNXlTw2YaIT3h0mBjRWwXi07Ujq7MFOGJD+AqNUPFDI0FG0H1yEAofz0nTchjXPhALJj4hFnYnY3er7IlD5nVvArm+iX5cKv9IO1SqJ7nZnSKAhKgG9bF7GDXBWOPcqujv38+e3plhO2bdeoQvqW+5CZTIxJQI0WaZsb6xv6zvdzFDIdEFEbe228Zf+5sQdCj979p54Amu5YIXLE7SFBLqY7p6iUqj6bGNhXjxIvxU0d6fGNEmVY7mIL+/BqFUkCbGAFOkUux/LWSw6bFjh0VjxwV0GwTTlETgXF3Gwz+MqzrREQTm8yGZQ/x7XamhNu9eg00IaCERlGm+Mw3KMPcVYKORJ238eRmHDQw= on: tags: true repo: gabrielcnr/pytest-datadir pytest-datadir/AUTHORS0000644000175000017500000000016213553577106014027 0ustar becuebecueAuthors and contributors:: Bruno Oliveira Edison Gustavo Muenz Gabriel Reis Guilherme Quentel Melo Mauricio Lima pytest-datadir/tox.ini0000644000175000017500000000012313553577106014267 0ustar becuebecue[tox] envlist = py{27,34,35,36,37} [testenv] commands= pytest {posargs:tests}