diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-pytest-datadir.spec | 244 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 246 insertions, 0 deletions
@@ -0,0 +1 @@ +/pytest-datadir-1.4.1.tar.gz diff --git a/python-pytest-datadir.spec b/python-pytest-datadir.spec new file mode 100644 index 0000000..5656434 --- /dev/null +++ b/python-pytest-datadir.spec @@ -0,0 +1,244 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pytest-datadir +Version: 1.4.1 +Release: 1 +Summary: pytest plugin for test data directories and files +License: MIT +URL: http://github.com/gabrielcnr/pytest-datadir +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ae/98/640d2c1d309506df53a4a6ef9dc8e80a0a3ff78b21cd42aca1ad2a6e3ea0/pytest-datadir-1.4.1.tar.gz +BuildArch: noarch + +Requires: python3-pytest + +%description +# pytest-datadir + +pytest plugin for manipulating test data directories and files. + +[](https://github.com/gabrielcnr/pytest-datadir/workflows/build/badge.svg?branch=master) +[](https://pypi.python.org/pypi/pytest-datadir) +[](https://anaconda.org/conda-forge/pytest-datadir) + +[](https://github.com/psf/black) + + +# 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. + + +%package -n python3-pytest-datadir +Summary: pytest plugin for test data directories and files +Provides: python-pytest-datadir +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pytest-datadir +# pytest-datadir + +pytest plugin for manipulating test data directories and files. + +[](https://github.com/gabrielcnr/pytest-datadir/workflows/build/badge.svg?branch=master) +[](https://pypi.python.org/pypi/pytest-datadir) +[](https://anaconda.org/conda-forge/pytest-datadir) + +[](https://github.com/psf/black) + + +# 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. + + +%package help +Summary: Development documents and examples for pytest-datadir +Provides: python3-pytest-datadir-doc +%description help +# pytest-datadir + +pytest plugin for manipulating test data directories and files. + +[](https://github.com/gabrielcnr/pytest-datadir/workflows/build/badge.svg?branch=master) +[](https://pypi.python.org/pypi/pytest-datadir) +[](https://anaconda.org/conda-forge/pytest-datadir) + +[](https://github.com/psf/black) + + +# 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. + + +%prep +%autosetup -n pytest-datadir-1.4.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pytest-datadir -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.4.1-1 +- Package Spec generated @@ -0,0 +1 @@ +d5043376db09d710e24a71b96026d728 pytest-datadir-1.4.1.tar.gz |
