diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-pytest-mimesis.spec | 299 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 301 insertions, 0 deletions
@@ -0,0 +1 @@ +/pytest_mimesis-1.1.0.tar.gz diff --git a/python-pytest-mimesis.spec b/python-pytest-mimesis.spec new file mode 100644 index 0000000..d8824eb --- /dev/null +++ b/python-pytest-mimesis.spec @@ -0,0 +1,299 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pytest-mimesis +Version: 1.1.0 +Release: 1 +Summary: Mimesis integration with the pytest test runner +License: MIT +URL: https://github.com/pytest-dev/pytest-mimesis +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/bb/37/0b0ecfcee75ef3b9d92592e2402df81de2f795bf4e266c3beb3df7c4f325/pytest_mimesis-1.1.0.tar.gz +BuildArch: noarch + +Requires: python3-pytest +Requires: python3-mimesis + +%description +## pytest-mimesis + + +[](https://travis-ci.com/pytest-dev/pytest-mimesis) +[](https://github.com/wemake-services/wemake-python-styleguide) +[](https://pypi.org/project/pytest-mimesis/) + +**pytest-mimesis** is a pytest plugin that provides pytest fixtures for [Mimesis](https://github.com/lk-geimfari/mimesis) providers. This allows you to quickly and easily use randomized, dummy data as part of your test suite. + + +## Installation + +```bash +pip install pytest-mimesis +``` + + +## Examples + +Using the personal provider as part of a test. + +```python +# your_module/__init__.py + +def validate_email(email): + # code that validates an e-mail address + return True +``` + +And your test file: + +```python +# tests/test_email.py + +from your_module import validate_email + +def test_validate_email(mimesis): + assert validate_email(mimesis('email')) +``` + +You can also specify locales: + +```python +@pytest.mark.parameterize('mimesis_locale', ['de']) # use German locale +def test_create_user(mimesis): + assert create_user(name=mimesis('full_name')) + + +@pytest.mark.parameterize('mimesis_locale', ['de', 'en', 'jp']) # test multiple locales +def test_add_phone(user, mimesis): + assert user.add_phone_number(name=mimesis('full_name')) +``` + + +## Fixtures + +We provide two public fixtures: `mimesis_locale` and `mimesis`. +While `mimesis_locale` is just a string (like: `en`, `ru`), +`mimesis` is an instance of `mimesis.schema.Field`. + +We use caching of `mimesis` instances for different locales for the whole +test session, so creating new instances is cheap. + + +## Related projects + +You might also be interested in: + +- [mimesis](https://github.com/lk-geimfari/mimesis) itself, it is awesome! +- [mimesis-factory](https://github.com/mimesis-lab/mimesis-factory) which brings `factory_boy` integration to `mimesis` + + +## License + +pytest-mimesis is licensed under the [MIT License](https://github.com/pytest-dev/pytest-mimesis/blob/master/LICENSE). + + +%package -n python3-pytest-mimesis +Summary: Mimesis integration with the pytest test runner +Provides: python-pytest-mimesis +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pytest-mimesis +## pytest-mimesis + + +[](https://travis-ci.com/pytest-dev/pytest-mimesis) +[](https://github.com/wemake-services/wemake-python-styleguide) +[](https://pypi.org/project/pytest-mimesis/) + +**pytest-mimesis** is a pytest plugin that provides pytest fixtures for [Mimesis](https://github.com/lk-geimfari/mimesis) providers. This allows you to quickly and easily use randomized, dummy data as part of your test suite. + + +## Installation + +```bash +pip install pytest-mimesis +``` + + +## Examples + +Using the personal provider as part of a test. + +```python +# your_module/__init__.py + +def validate_email(email): + # code that validates an e-mail address + return True +``` + +And your test file: + +```python +# tests/test_email.py + +from your_module import validate_email + +def test_validate_email(mimesis): + assert validate_email(mimesis('email')) +``` + +You can also specify locales: + +```python +@pytest.mark.parameterize('mimesis_locale', ['de']) # use German locale +def test_create_user(mimesis): + assert create_user(name=mimesis('full_name')) + + +@pytest.mark.parameterize('mimesis_locale', ['de', 'en', 'jp']) # test multiple locales +def test_add_phone(user, mimesis): + assert user.add_phone_number(name=mimesis('full_name')) +``` + + +## Fixtures + +We provide two public fixtures: `mimesis_locale` and `mimesis`. +While `mimesis_locale` is just a string (like: `en`, `ru`), +`mimesis` is an instance of `mimesis.schema.Field`. + +We use caching of `mimesis` instances for different locales for the whole +test session, so creating new instances is cheap. + + +## Related projects + +You might also be interested in: + +- [mimesis](https://github.com/lk-geimfari/mimesis) itself, it is awesome! +- [mimesis-factory](https://github.com/mimesis-lab/mimesis-factory) which brings `factory_boy` integration to `mimesis` + + +## License + +pytest-mimesis is licensed under the [MIT License](https://github.com/pytest-dev/pytest-mimesis/blob/master/LICENSE). + + +%package help +Summary: Development documents and examples for pytest-mimesis +Provides: python3-pytest-mimesis-doc +%description help +## pytest-mimesis + + +[](https://travis-ci.com/pytest-dev/pytest-mimesis) +[](https://github.com/wemake-services/wemake-python-styleguide) +[](https://pypi.org/project/pytest-mimesis/) + +**pytest-mimesis** is a pytest plugin that provides pytest fixtures for [Mimesis](https://github.com/lk-geimfari/mimesis) providers. This allows you to quickly and easily use randomized, dummy data as part of your test suite. + + +## Installation + +```bash +pip install pytest-mimesis +``` + + +## Examples + +Using the personal provider as part of a test. + +```python +# your_module/__init__.py + +def validate_email(email): + # code that validates an e-mail address + return True +``` + +And your test file: + +```python +# tests/test_email.py + +from your_module import validate_email + +def test_validate_email(mimesis): + assert validate_email(mimesis('email')) +``` + +You can also specify locales: + +```python +@pytest.mark.parameterize('mimesis_locale', ['de']) # use German locale +def test_create_user(mimesis): + assert create_user(name=mimesis('full_name')) + + +@pytest.mark.parameterize('mimesis_locale', ['de', 'en', 'jp']) # test multiple locales +def test_add_phone(user, mimesis): + assert user.add_phone_number(name=mimesis('full_name')) +``` + + +## Fixtures + +We provide two public fixtures: `mimesis_locale` and `mimesis`. +While `mimesis_locale` is just a string (like: `en`, `ru`), +`mimesis` is an instance of `mimesis.schema.Field`. + +We use caching of `mimesis` instances for different locales for the whole +test session, so creating new instances is cheap. + + +## Related projects + +You might also be interested in: + +- [mimesis](https://github.com/lk-geimfari/mimesis) itself, it is awesome! +- [mimesis-factory](https://github.com/mimesis-lab/mimesis-factory) which brings `factory_boy` integration to `mimesis` + + +## License + +pytest-mimesis is licensed under the [MIT License](https://github.com/pytest-dev/pytest-mimesis/blob/master/LICENSE). + + +%prep +%autosetup -n pytest-mimesis-1.1.0 + +%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-mimesis -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.0-1 +- Package Spec generated @@ -0,0 +1 @@ +e90de9fb8e1a49ceb0fdfcfc5c58e4f6 pytest_mimesis-1.1.0.tar.gz |