diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-10 12:33:18 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-10 12:33:18 +0000 |
| commit | 5e9d8da0cbbfcd2a91ddad8246211b2837bf989c (patch) | |
| tree | c9bf1f09f6fc0206f7bcedd08d4233057d4ab3ba | |
| parent | aeea1f1a76410446afae43ee48f9a74d32743dc0 (diff) | |
automatic import of python-snapshottest
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-snapshottest.spec | 469 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 471 insertions, 0 deletions
@@ -0,0 +1 @@ +/snapshottest-0.6.0.tar.gz diff --git a/python-snapshottest.spec b/python-snapshottest.spec new file mode 100644 index 0000000..8b5e9b8 --- /dev/null +++ b/python-snapshottest.spec @@ -0,0 +1,469 @@ +%global _empty_manifest_terminate_build 0 +Name: python-snapshottest +Version: 0.6.0 +Release: 1 +Summary: Snapshot testing for pytest, unittest, Django, and Nose +License: MIT +URL: https://github.com/syrusakbary/snapshottest +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/14/6a/6a6ff192326d79048f44c9348acad760070cce68f9fc9c9832c3efa7aca8/snapshottest-0.6.0.tar.gz +BuildArch: noarch + +Requires: python3-six +Requires: python3-termcolor +Requires: python3-fastdiff +Requires: python3-nose +Requires: python3-pytest +Requires: python3-six +Requires: python3-pytest +Requires: python3-pytest-cov +Requires: python3-nose +Requires: python3-django + +%description +# SnapshotTest [![travis][travis-image]][travis-url] [![pypi][pypi-image]][pypi-url] + +[travis-image]: https://img.shields.io/travis/syrusakbary/snapshottest.svg?style=flat +[travis-url]: https://travis-ci.org/syrusakbary/snapshottest +[pypi-image]: https://img.shields.io/pypi/v/snapshottest.svg?style=flat +[pypi-url]: https://pypi.python.org/pypi/snapshottest + + +Snapshot testing is a way to test your APIs without writing actual test cases. + +1. A snapshot is a single state of your API, saved in a file. +2. You have a set of snapshots for your API endpoints. +3. Once you add a new feature, you can generate *automatically* new snapshots for the updated API. + +## Installation + + $ pip install snapshottest + + +## Usage with unittest/nose + +```python +from snapshottest import TestCase + +class APITestCase(TestCase): + def test_api_me(self): + """Testing the API for /me""" + my_api_response = api.client.get('/me') + self.assertMatchSnapshot(my_api_response) + + # Set custom snapshot name: `gpg_response` + my_gpg_response = api.client.get('/me?gpg_key') + self.assertMatchSnapshot(my_gpg_response, 'gpg_response') +``` + +If you want to update the snapshots automatically you can use the `nosetests --snapshot-update`. + +Check the [Unittest example](https://github.com/syrusakbary/snapshottest/tree/master/examples/unittest). + +## Usage with pytest + +```python +def test_mything(snapshot): + """Testing the API for /me""" + my_api_response = api.client.get('/me') + snapshot.assert_match(my_api_response) + + # Set custom snapshot name: `gpg_response` + my_gpg_response = api.client.get('/me?gpg_key') + snapshot.assert_match(my_gpg_response, 'gpg_response') +``` + +If you want to update the snapshots automatically you can use the `--snapshot-update` config. + +Check the [Pytest example](https://github.com/syrusakbary/snapshottest/tree/master/examples/pytest). + +## Usage with django +Add to your settings: +```python +TEST_RUNNER = 'snapshottest.django.TestRunner' +``` +To create your snapshottest: +```python +from snapshottest.django import TestCase + +class APITestCase(TestCase): + def test_api_me(self): + """Testing the API for /me""" + my_api_response = api.client.get('/me') + self.assertMatchSnapshot(my_api_response) +``` +If you want to update the snapshots automatically you can use the `python manage.py test --snapshot-update`. +Check the [Django example](https://github.com/syrusakbary/snapshottest/tree/master/examples/django_project). + +## Disabling terminal colors + +Set the environment variable `ANSI_COLORS_DISABLED` (to any value), e.g. + + ANSI_COLORS_DISABLED=1 pytest + + +# Contributing + +After cloning this repo and configuring a virtualenv for snapshottest (optional, but highly recommended), ensure dependencies are installed by running: + +```sh +make install +``` + +After developing, the full test suite can be evaluated by running: + +```sh +make lint +# and +make test +``` + +# Notes + +This package is heavily inspired in [jest snapshot testing](https://facebook.github.io/jest/docs/snapshot-testing.html). + +# Reasons to use this package + +> Most of this content is taken from the [Jest snapshot blogpost](https://facebook.github.io/jest/blog/2016/07/27/jest-14.html). + +We want to make it as frictionless as possible to write good tests that are useful. +We observed that when engineers are provided with ready-to-use tools, they end up writing more tests, which in turn results in stable and healthy code bases. + +However engineers frequently spend more time writing a test than the component itself. As a result many people stopped writing tests altogether which eventually led to instabilities. + +A typical snapshot test case for a mobile app renders a UI component, takes a screenshot, then compares it to a reference image stored alongside the test. The test will fail if the two images do not match: either the change is unexpected, or the screenshot needs to be updated to the new version of the UI component. + + +## Snapshot Testing with SnapshotTest + +A similar approach can be taken when it comes to testing your APIs. +Instead of rendering the graphical UI, which would require building the entire app, you can use a test renderer to quickly generate a serializable value for your API response. + + +## License + +[MIT License](https://github.com/syrusakbary/snapshottest/blob/master/LICENSE) + +[![coveralls][coveralls-image]][coveralls-url] + +[coveralls-image]: https://coveralls.io/repos/syrusakbary/snapshottest/badge.svg?branch=master&service=github +[coveralls-url]: https://coveralls.io/github/syrusakbary/snapshottest?branch=master + + + + +%package -n python3-snapshottest +Summary: Snapshot testing for pytest, unittest, Django, and Nose +Provides: python-snapshottest +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-snapshottest +# SnapshotTest [![travis][travis-image]][travis-url] [![pypi][pypi-image]][pypi-url] + +[travis-image]: https://img.shields.io/travis/syrusakbary/snapshottest.svg?style=flat +[travis-url]: https://travis-ci.org/syrusakbary/snapshottest +[pypi-image]: https://img.shields.io/pypi/v/snapshottest.svg?style=flat +[pypi-url]: https://pypi.python.org/pypi/snapshottest + + +Snapshot testing is a way to test your APIs without writing actual test cases. + +1. A snapshot is a single state of your API, saved in a file. +2. You have a set of snapshots for your API endpoints. +3. Once you add a new feature, you can generate *automatically* new snapshots for the updated API. + +## Installation + + $ pip install snapshottest + + +## Usage with unittest/nose + +```python +from snapshottest import TestCase + +class APITestCase(TestCase): + def test_api_me(self): + """Testing the API for /me""" + my_api_response = api.client.get('/me') + self.assertMatchSnapshot(my_api_response) + + # Set custom snapshot name: `gpg_response` + my_gpg_response = api.client.get('/me?gpg_key') + self.assertMatchSnapshot(my_gpg_response, 'gpg_response') +``` + +If you want to update the snapshots automatically you can use the `nosetests --snapshot-update`. + +Check the [Unittest example](https://github.com/syrusakbary/snapshottest/tree/master/examples/unittest). + +## Usage with pytest + +```python +def test_mything(snapshot): + """Testing the API for /me""" + my_api_response = api.client.get('/me') + snapshot.assert_match(my_api_response) + + # Set custom snapshot name: `gpg_response` + my_gpg_response = api.client.get('/me?gpg_key') + snapshot.assert_match(my_gpg_response, 'gpg_response') +``` + +If you want to update the snapshots automatically you can use the `--snapshot-update` config. + +Check the [Pytest example](https://github.com/syrusakbary/snapshottest/tree/master/examples/pytest). + +## Usage with django +Add to your settings: +```python +TEST_RUNNER = 'snapshottest.django.TestRunner' +``` +To create your snapshottest: +```python +from snapshottest.django import TestCase + +class APITestCase(TestCase): + def test_api_me(self): + """Testing the API for /me""" + my_api_response = api.client.get('/me') + self.assertMatchSnapshot(my_api_response) +``` +If you want to update the snapshots automatically you can use the `python manage.py test --snapshot-update`. +Check the [Django example](https://github.com/syrusakbary/snapshottest/tree/master/examples/django_project). + +## Disabling terminal colors + +Set the environment variable `ANSI_COLORS_DISABLED` (to any value), e.g. + + ANSI_COLORS_DISABLED=1 pytest + + +# Contributing + +After cloning this repo and configuring a virtualenv for snapshottest (optional, but highly recommended), ensure dependencies are installed by running: + +```sh +make install +``` + +After developing, the full test suite can be evaluated by running: + +```sh +make lint +# and +make test +``` + +# Notes + +This package is heavily inspired in [jest snapshot testing](https://facebook.github.io/jest/docs/snapshot-testing.html). + +# Reasons to use this package + +> Most of this content is taken from the [Jest snapshot blogpost](https://facebook.github.io/jest/blog/2016/07/27/jest-14.html). + +We want to make it as frictionless as possible to write good tests that are useful. +We observed that when engineers are provided with ready-to-use tools, they end up writing more tests, which in turn results in stable and healthy code bases. + +However engineers frequently spend more time writing a test than the component itself. As a result many people stopped writing tests altogether which eventually led to instabilities. + +A typical snapshot test case for a mobile app renders a UI component, takes a screenshot, then compares it to a reference image stored alongside the test. The test will fail if the two images do not match: either the change is unexpected, or the screenshot needs to be updated to the new version of the UI component. + + +## Snapshot Testing with SnapshotTest + +A similar approach can be taken when it comes to testing your APIs. +Instead of rendering the graphical UI, which would require building the entire app, you can use a test renderer to quickly generate a serializable value for your API response. + + +## License + +[MIT License](https://github.com/syrusakbary/snapshottest/blob/master/LICENSE) + +[![coveralls][coveralls-image]][coveralls-url] + +[coveralls-image]: https://coveralls.io/repos/syrusakbary/snapshottest/badge.svg?branch=master&service=github +[coveralls-url]: https://coveralls.io/github/syrusakbary/snapshottest?branch=master + + + + +%package help +Summary: Development documents and examples for snapshottest +Provides: python3-snapshottest-doc +%description help +# SnapshotTest [![travis][travis-image]][travis-url] [![pypi][pypi-image]][pypi-url] + +[travis-image]: https://img.shields.io/travis/syrusakbary/snapshottest.svg?style=flat +[travis-url]: https://travis-ci.org/syrusakbary/snapshottest +[pypi-image]: https://img.shields.io/pypi/v/snapshottest.svg?style=flat +[pypi-url]: https://pypi.python.org/pypi/snapshottest + + +Snapshot testing is a way to test your APIs without writing actual test cases. + +1. A snapshot is a single state of your API, saved in a file. +2. You have a set of snapshots for your API endpoints. +3. Once you add a new feature, you can generate *automatically* new snapshots for the updated API. + +## Installation + + $ pip install snapshottest + + +## Usage with unittest/nose + +```python +from snapshottest import TestCase + +class APITestCase(TestCase): + def test_api_me(self): + """Testing the API for /me""" + my_api_response = api.client.get('/me') + self.assertMatchSnapshot(my_api_response) + + # Set custom snapshot name: `gpg_response` + my_gpg_response = api.client.get('/me?gpg_key') + self.assertMatchSnapshot(my_gpg_response, 'gpg_response') +``` + +If you want to update the snapshots automatically you can use the `nosetests --snapshot-update`. + +Check the [Unittest example](https://github.com/syrusakbary/snapshottest/tree/master/examples/unittest). + +## Usage with pytest + +```python +def test_mything(snapshot): + """Testing the API for /me""" + my_api_response = api.client.get('/me') + snapshot.assert_match(my_api_response) + + # Set custom snapshot name: `gpg_response` + my_gpg_response = api.client.get('/me?gpg_key') + snapshot.assert_match(my_gpg_response, 'gpg_response') +``` + +If you want to update the snapshots automatically you can use the `--snapshot-update` config. + +Check the [Pytest example](https://github.com/syrusakbary/snapshottest/tree/master/examples/pytest). + +## Usage with django +Add to your settings: +```python +TEST_RUNNER = 'snapshottest.django.TestRunner' +``` +To create your snapshottest: +```python +from snapshottest.django import TestCase + +class APITestCase(TestCase): + def test_api_me(self): + """Testing the API for /me""" + my_api_response = api.client.get('/me') + self.assertMatchSnapshot(my_api_response) +``` +If you want to update the snapshots automatically you can use the `python manage.py test --snapshot-update`. +Check the [Django example](https://github.com/syrusakbary/snapshottest/tree/master/examples/django_project). + +## Disabling terminal colors + +Set the environment variable `ANSI_COLORS_DISABLED` (to any value), e.g. + + ANSI_COLORS_DISABLED=1 pytest + + +# Contributing + +After cloning this repo and configuring a virtualenv for snapshottest (optional, but highly recommended), ensure dependencies are installed by running: + +```sh +make install +``` + +After developing, the full test suite can be evaluated by running: + +```sh +make lint +# and +make test +``` + +# Notes + +This package is heavily inspired in [jest snapshot testing](https://facebook.github.io/jest/docs/snapshot-testing.html). + +# Reasons to use this package + +> Most of this content is taken from the [Jest snapshot blogpost](https://facebook.github.io/jest/blog/2016/07/27/jest-14.html). + +We want to make it as frictionless as possible to write good tests that are useful. +We observed that when engineers are provided with ready-to-use tools, they end up writing more tests, which in turn results in stable and healthy code bases. + +However engineers frequently spend more time writing a test than the component itself. As a result many people stopped writing tests altogether which eventually led to instabilities. + +A typical snapshot test case for a mobile app renders a UI component, takes a screenshot, then compares it to a reference image stored alongside the test. The test will fail if the two images do not match: either the change is unexpected, or the screenshot needs to be updated to the new version of the UI component. + + +## Snapshot Testing with SnapshotTest + +A similar approach can be taken when it comes to testing your APIs. +Instead of rendering the graphical UI, which would require building the entire app, you can use a test renderer to quickly generate a serializable value for your API response. + + +## License + +[MIT License](https://github.com/syrusakbary/snapshottest/blob/master/LICENSE) + +[![coveralls][coveralls-image]][coveralls-url] + +[coveralls-image]: https://coveralls.io/repos/syrusakbary/snapshottest/badge.svg?branch=master&service=github +[coveralls-url]: https://coveralls.io/github/syrusakbary/snapshottest?branch=master + + + + +%prep +%autosetup -n snapshottest-0.6.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-snapshottest -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.6.0-1 +- Package Spec generated @@ -0,0 +1 @@ +d9cdbe189ddab8d7bb2505ecd5c84044 snapshottest-0.6.0.tar.gz |
