summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-31 05:08:07 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-31 05:08:07 +0000
commit8302308c588ec1a34a22c730f5f5041496652d61 (patch)
treee6dcdfcb92f9dabf18e3d2b31e04be6347751af0
parentd19f7a62a9b5e6b20099a29ff3ee567577c0a0b8 (diff)
automatic import of python-pytest-aoc
-rw-r--r--.gitignore1
-rw-r--r--python-pytest-aoc.spec569
-rw-r--r--sources1
3 files changed, 571 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..f9f06bd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/pytest-aoc-1.22.0.tar.gz
diff --git a/python-pytest-aoc.spec b/python-pytest-aoc.spec
new file mode 100644
index 0000000..c89d240
--- /dev/null
+++ b/python-pytest-aoc.spec
@@ -0,0 +1,569 @@
+%global _empty_manifest_terminate_build 0
+Name: python-pytest-aoc
+Version: 1.22.0
+Release: 1
+Summary: Downloads puzzle inputs for Advent of Code and synthesizes PyTest fixtures
+License: MIT
+URL: https://github.com/j0057/pytest-aoc
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b9/ba/974f317727d53ebb5aa0ef38493a0f46b9e9de63ca1ad8a6fb78de7855e5/pytest-aoc-1.22.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-requests
+Requires: python3-pip
+Requires: python3-setuptools
+Requires: python3-setuptools-scm
+Requires: python3-build
+Requires: python3-wheel
+Requires: python3-twine
+Requires: python3-tox
+Requires: python3-tox-venv
+Requires: python3-pytest
+Requires: python3-pytest-cov
+Requires: python3-pytest-freezegun
+Requires: python3-pytest-responses
+Requires: python3-pytest-mock
+
+%description
+# pytest-aoc
+
+This pytest plugin downloads puzzle inputs for [Advent of Code][] and
+synthesizes fixtures that you can use in your tests.
+
+[![PyPI](https://img.shields.io/pypi/v/pytest-aoc?style=flat-square)][pypi]
+[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-aoc?style=flat-square)][pypi]
+[![PyPI - Implementation](https://img.shields.io/pypi/implementation/pytest-aoc?style=flat-square)][pypi]
+
+[![GitHub issues](https://img.shields.io/github/issues/j0057/pytest-aoc?style=flat-square)][issues]
+
+[![PyPI - License](https://img.shields.io/pypi/l/pytest-aoc?style=flat-square)][license]
+
+[Advent of Code]: https://adventofcode.com/
+
+[pypi]: https://pypi.org/project/pytest-aoc
+[issues]: https://github.com/j0057/pytest-aoc/issues
+[license]: ./LICENSE
+
+## Does this DDoS the adventofcode.com website?
+
+This plugin tries pretty hard to not hit the adventofcode.com website unless
+absolutely necessary. When the test session starts, the puzzle inputs that
+should be available are calculated based on the system clock. For every input
+that should be available (after 05:00:00 GMT), if no corresponding text file is
+found on disk, it gets downloaded and saved, if the HTTP status code is 200 OK.
+
+The personal downloaded puzzle inputs should be committed to source control, so
+that pytest doesn't need to hit the adventofcode.com API to run the tests in
+another environment.
+
+New in version 1.22.0: the code also sleeps (2.5 seconds by default) after
+hitting the server. This can be disabled if you have leaderboard aspirations,
+but really, do you have time to be practising TDD in that case? (I'll answer
+that for you: no, you do not.)
+
+## Installing and configuring
+
+Installing is easy: `python -m pip install pytest-aoc`. Next you will need to configure
+_two_ things: for which event (year) the plugin should download inputs, and a
+valid session cookie. These are normally valid for about a month or so.
+
+To set the year, put it in `setup.cfg`:
+
+ [tool:pytest]
+ aoc_year = 2018
+
+Then, put a valid session ID in a file named `.cookie` and also name this file
+in your `.gitignore`.
+
+With these two things in place, when running pytest, this plugin will download
+any missing inputs, and generate pytest fixtures that you can use in your test
+functions, see 'Using' and 'Fixtures', below.
+
+## Using
+
+With this plugin properly configured, you can write tests like this:
+
+ def test_01a(day01_numbers):
+ assert sum(day01_numbers) == 123
+
+Here, the parameter `day01_numbers` is a fixture that contains the numbers on
+each line in the file `input/day01.txt`.
+
+## Fixtures
+
+These fixtures are synthesized for each available day. They're not executed
+until you ask for them in a test.
+
+- `dayNN_text`: The text in the input file, but stripped of any leading and trailing whitespace.
+ ~ `"spam"`
+
+- `dayNN_raw`: The raw text in the input file.
+ ~ `"eggs\n"`
+
+- `dayNN_lines`: A list of stripped lines.
+ ~ `["spam", "eggs", "albatross"]`
+
+- `dayNN_numbers`: A list of numbers.
+ ~ `[1, 1, 2, 3, 5, 8]`
+
+- `dayNN_number`: A single number.
+ ~ `5`
+
+- `dayNN_grid`: A list of lists, representing a grid of textual values.
+ ~ `[["spam", "eggs"], ["ham", "albatross"]]`
+
+- `dayNN_number_grid`: A list of lists, representing a grid of numbers.
+ ~ `[[8, 1, 6], [3, 5, 7], [4, 9, 2]]`
+
+## Command-line and configuration options
+
+You can pass the options from the command line or set them in setup.cfg. The
+command line takes precedence.
+
+- `--aoc-year`/`aoc_year`: The year for which to download puzzle inputs.
+ (Mandatory)
+- `--aoc-session-id`: The session ID to use for requesting puzzle inputs. This
+ one has no equivalent setup.cfg key; that's a security feature. (Optional)
+- `--aoc-session-file`/`aoc_session_file`: The file from which to read the
+ session ID. (Optional; default `.cookie`)
+- `--aoc-input-dir`/`aoc_input_dir`: The directory in which inputs are stored.
+ Will be created if it doesn't exist. (Optional; default `input`)
+- `--aoc-sleep-time`/`aoc_sleep_time`: Time to sleep after downloading puzzle
+ input, set to `0` if you're a hardcore quick-coder, can't miss the default
+ 2.5 seconds, and promise to not DDoS the adventofcode.com website. (Optional,
+ default `2.5`).
+
+## Developing / testing
+
+Set environment variables using `. .envrc` or by automatically loading them
+using `direnv allow`.
+
+Create a virtualenv named `env` and install an editable version of this package
+with all extra development dependencies:
+
+ python -m venv env
+ python -m pip install -U -e .[dev,test]
+
+Run tests directly, to test against the current Python, or via tox to test
+against multiple Python versions:
+
+ python -m pytest
+ python -m tox
+
+## Releasing
+
+This package uses [setuptools-scm][] to derive the version from tags in the
+Git history. I use [twine][] to upload the distribution files to PyPI and
+[github-cli][] to create releases on GitHub.
+
+The procedure goes like this:
+
+(Optional) Tag the release version (or it will be a dev release on the next version as
+derived by `setuptools-scm`) where `x.y.z` is the version:
+
+ git tag -a x.y.z
+
+Check that the version is actually sane:
+
+ python -m setuptools_scm
+
+Bake an sdist and a wheel into a clean `dist` directory:
+
+ rm -f dist/*
+ python -m build
+
+Upload the goods to PyPI:
+
+ python -m twine upload dist/*
+
+Upload the goods to Github, where again `x.y.z` is the version:
+
+ git push github master --tags
+ gh release create --prerelease x.y.z dist/*
+
+(Leave out the `--prerelease` flag as necessary.)
+
+[setuptools-scm]: https://pypi.org/project/setuptools-scm/
+[twine]: https://pypi.org/project/twine/
+[github-cli]: https://cli.github.com/
+
+
+%package -n python3-pytest-aoc
+Summary: Downloads puzzle inputs for Advent of Code and synthesizes PyTest fixtures
+Provides: python-pytest-aoc
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-pytest-aoc
+# pytest-aoc
+
+This pytest plugin downloads puzzle inputs for [Advent of Code][] and
+synthesizes fixtures that you can use in your tests.
+
+[![PyPI](https://img.shields.io/pypi/v/pytest-aoc?style=flat-square)][pypi]
+[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-aoc?style=flat-square)][pypi]
+[![PyPI - Implementation](https://img.shields.io/pypi/implementation/pytest-aoc?style=flat-square)][pypi]
+
+[![GitHub issues](https://img.shields.io/github/issues/j0057/pytest-aoc?style=flat-square)][issues]
+
+[![PyPI - License](https://img.shields.io/pypi/l/pytest-aoc?style=flat-square)][license]
+
+[Advent of Code]: https://adventofcode.com/
+
+[pypi]: https://pypi.org/project/pytest-aoc
+[issues]: https://github.com/j0057/pytest-aoc/issues
+[license]: ./LICENSE
+
+## Does this DDoS the adventofcode.com website?
+
+This plugin tries pretty hard to not hit the adventofcode.com website unless
+absolutely necessary. When the test session starts, the puzzle inputs that
+should be available are calculated based on the system clock. For every input
+that should be available (after 05:00:00 GMT), if no corresponding text file is
+found on disk, it gets downloaded and saved, if the HTTP status code is 200 OK.
+
+The personal downloaded puzzle inputs should be committed to source control, so
+that pytest doesn't need to hit the adventofcode.com API to run the tests in
+another environment.
+
+New in version 1.22.0: the code also sleeps (2.5 seconds by default) after
+hitting the server. This can be disabled if you have leaderboard aspirations,
+but really, do you have time to be practising TDD in that case? (I'll answer
+that for you: no, you do not.)
+
+## Installing and configuring
+
+Installing is easy: `python -m pip install pytest-aoc`. Next you will need to configure
+_two_ things: for which event (year) the plugin should download inputs, and a
+valid session cookie. These are normally valid for about a month or so.
+
+To set the year, put it in `setup.cfg`:
+
+ [tool:pytest]
+ aoc_year = 2018
+
+Then, put a valid session ID in a file named `.cookie` and also name this file
+in your `.gitignore`.
+
+With these two things in place, when running pytest, this plugin will download
+any missing inputs, and generate pytest fixtures that you can use in your test
+functions, see 'Using' and 'Fixtures', below.
+
+## Using
+
+With this plugin properly configured, you can write tests like this:
+
+ def test_01a(day01_numbers):
+ assert sum(day01_numbers) == 123
+
+Here, the parameter `day01_numbers` is a fixture that contains the numbers on
+each line in the file `input/day01.txt`.
+
+## Fixtures
+
+These fixtures are synthesized for each available day. They're not executed
+until you ask for them in a test.
+
+- `dayNN_text`: The text in the input file, but stripped of any leading and trailing whitespace.
+ ~ `"spam"`
+
+- `dayNN_raw`: The raw text in the input file.
+ ~ `"eggs\n"`
+
+- `dayNN_lines`: A list of stripped lines.
+ ~ `["spam", "eggs", "albatross"]`
+
+- `dayNN_numbers`: A list of numbers.
+ ~ `[1, 1, 2, 3, 5, 8]`
+
+- `dayNN_number`: A single number.
+ ~ `5`
+
+- `dayNN_grid`: A list of lists, representing a grid of textual values.
+ ~ `[["spam", "eggs"], ["ham", "albatross"]]`
+
+- `dayNN_number_grid`: A list of lists, representing a grid of numbers.
+ ~ `[[8, 1, 6], [3, 5, 7], [4, 9, 2]]`
+
+## Command-line and configuration options
+
+You can pass the options from the command line or set them in setup.cfg. The
+command line takes precedence.
+
+- `--aoc-year`/`aoc_year`: The year for which to download puzzle inputs.
+ (Mandatory)
+- `--aoc-session-id`: The session ID to use for requesting puzzle inputs. This
+ one has no equivalent setup.cfg key; that's a security feature. (Optional)
+- `--aoc-session-file`/`aoc_session_file`: The file from which to read the
+ session ID. (Optional; default `.cookie`)
+- `--aoc-input-dir`/`aoc_input_dir`: The directory in which inputs are stored.
+ Will be created if it doesn't exist. (Optional; default `input`)
+- `--aoc-sleep-time`/`aoc_sleep_time`: Time to sleep after downloading puzzle
+ input, set to `0` if you're a hardcore quick-coder, can't miss the default
+ 2.5 seconds, and promise to not DDoS the adventofcode.com website. (Optional,
+ default `2.5`).
+
+## Developing / testing
+
+Set environment variables using `. .envrc` or by automatically loading them
+using `direnv allow`.
+
+Create a virtualenv named `env` and install an editable version of this package
+with all extra development dependencies:
+
+ python -m venv env
+ python -m pip install -U -e .[dev,test]
+
+Run tests directly, to test against the current Python, or via tox to test
+against multiple Python versions:
+
+ python -m pytest
+ python -m tox
+
+## Releasing
+
+This package uses [setuptools-scm][] to derive the version from tags in the
+Git history. I use [twine][] to upload the distribution files to PyPI and
+[github-cli][] to create releases on GitHub.
+
+The procedure goes like this:
+
+(Optional) Tag the release version (or it will be a dev release on the next version as
+derived by `setuptools-scm`) where `x.y.z` is the version:
+
+ git tag -a x.y.z
+
+Check that the version is actually sane:
+
+ python -m setuptools_scm
+
+Bake an sdist and a wheel into a clean `dist` directory:
+
+ rm -f dist/*
+ python -m build
+
+Upload the goods to PyPI:
+
+ python -m twine upload dist/*
+
+Upload the goods to Github, where again `x.y.z` is the version:
+
+ git push github master --tags
+ gh release create --prerelease x.y.z dist/*
+
+(Leave out the `--prerelease` flag as necessary.)
+
+[setuptools-scm]: https://pypi.org/project/setuptools-scm/
+[twine]: https://pypi.org/project/twine/
+[github-cli]: https://cli.github.com/
+
+
+%package help
+Summary: Development documents and examples for pytest-aoc
+Provides: python3-pytest-aoc-doc
+%description help
+# pytest-aoc
+
+This pytest plugin downloads puzzle inputs for [Advent of Code][] and
+synthesizes fixtures that you can use in your tests.
+
+[![PyPI](https://img.shields.io/pypi/v/pytest-aoc?style=flat-square)][pypi]
+[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-aoc?style=flat-square)][pypi]
+[![PyPI - Implementation](https://img.shields.io/pypi/implementation/pytest-aoc?style=flat-square)][pypi]
+
+[![GitHub issues](https://img.shields.io/github/issues/j0057/pytest-aoc?style=flat-square)][issues]
+
+[![PyPI - License](https://img.shields.io/pypi/l/pytest-aoc?style=flat-square)][license]
+
+[Advent of Code]: https://adventofcode.com/
+
+[pypi]: https://pypi.org/project/pytest-aoc
+[issues]: https://github.com/j0057/pytest-aoc/issues
+[license]: ./LICENSE
+
+## Does this DDoS the adventofcode.com website?
+
+This plugin tries pretty hard to not hit the adventofcode.com website unless
+absolutely necessary. When the test session starts, the puzzle inputs that
+should be available are calculated based on the system clock. For every input
+that should be available (after 05:00:00 GMT), if no corresponding text file is
+found on disk, it gets downloaded and saved, if the HTTP status code is 200 OK.
+
+The personal downloaded puzzle inputs should be committed to source control, so
+that pytest doesn't need to hit the adventofcode.com API to run the tests in
+another environment.
+
+New in version 1.22.0: the code also sleeps (2.5 seconds by default) after
+hitting the server. This can be disabled if you have leaderboard aspirations,
+but really, do you have time to be practising TDD in that case? (I'll answer
+that for you: no, you do not.)
+
+## Installing and configuring
+
+Installing is easy: `python -m pip install pytest-aoc`. Next you will need to configure
+_two_ things: for which event (year) the plugin should download inputs, and a
+valid session cookie. These are normally valid for about a month or so.
+
+To set the year, put it in `setup.cfg`:
+
+ [tool:pytest]
+ aoc_year = 2018
+
+Then, put a valid session ID in a file named `.cookie` and also name this file
+in your `.gitignore`.
+
+With these two things in place, when running pytest, this plugin will download
+any missing inputs, and generate pytest fixtures that you can use in your test
+functions, see 'Using' and 'Fixtures', below.
+
+## Using
+
+With this plugin properly configured, you can write tests like this:
+
+ def test_01a(day01_numbers):
+ assert sum(day01_numbers) == 123
+
+Here, the parameter `day01_numbers` is a fixture that contains the numbers on
+each line in the file `input/day01.txt`.
+
+## Fixtures
+
+These fixtures are synthesized for each available day. They're not executed
+until you ask for them in a test.
+
+- `dayNN_text`: The text in the input file, but stripped of any leading and trailing whitespace.
+ ~ `"spam"`
+
+- `dayNN_raw`: The raw text in the input file.
+ ~ `"eggs\n"`
+
+- `dayNN_lines`: A list of stripped lines.
+ ~ `["spam", "eggs", "albatross"]`
+
+- `dayNN_numbers`: A list of numbers.
+ ~ `[1, 1, 2, 3, 5, 8]`
+
+- `dayNN_number`: A single number.
+ ~ `5`
+
+- `dayNN_grid`: A list of lists, representing a grid of textual values.
+ ~ `[["spam", "eggs"], ["ham", "albatross"]]`
+
+- `dayNN_number_grid`: A list of lists, representing a grid of numbers.
+ ~ `[[8, 1, 6], [3, 5, 7], [4, 9, 2]]`
+
+## Command-line and configuration options
+
+You can pass the options from the command line or set them in setup.cfg. The
+command line takes precedence.
+
+- `--aoc-year`/`aoc_year`: The year for which to download puzzle inputs.
+ (Mandatory)
+- `--aoc-session-id`: The session ID to use for requesting puzzle inputs. This
+ one has no equivalent setup.cfg key; that's a security feature. (Optional)
+- `--aoc-session-file`/`aoc_session_file`: The file from which to read the
+ session ID. (Optional; default `.cookie`)
+- `--aoc-input-dir`/`aoc_input_dir`: The directory in which inputs are stored.
+ Will be created if it doesn't exist. (Optional; default `input`)
+- `--aoc-sleep-time`/`aoc_sleep_time`: Time to sleep after downloading puzzle
+ input, set to `0` if you're a hardcore quick-coder, can't miss the default
+ 2.5 seconds, and promise to not DDoS the adventofcode.com website. (Optional,
+ default `2.5`).
+
+## Developing / testing
+
+Set environment variables using `. .envrc` or by automatically loading them
+using `direnv allow`.
+
+Create a virtualenv named `env` and install an editable version of this package
+with all extra development dependencies:
+
+ python -m venv env
+ python -m pip install -U -e .[dev,test]
+
+Run tests directly, to test against the current Python, or via tox to test
+against multiple Python versions:
+
+ python -m pytest
+ python -m tox
+
+## Releasing
+
+This package uses [setuptools-scm][] to derive the version from tags in the
+Git history. I use [twine][] to upload the distribution files to PyPI and
+[github-cli][] to create releases on GitHub.
+
+The procedure goes like this:
+
+(Optional) Tag the release version (or it will be a dev release on the next version as
+derived by `setuptools-scm`) where `x.y.z` is the version:
+
+ git tag -a x.y.z
+
+Check that the version is actually sane:
+
+ python -m setuptools_scm
+
+Bake an sdist and a wheel into a clean `dist` directory:
+
+ rm -f dist/*
+ python -m build
+
+Upload the goods to PyPI:
+
+ python -m twine upload dist/*
+
+Upload the goods to Github, where again `x.y.z` is the version:
+
+ git push github master --tags
+ gh release create --prerelease x.y.z dist/*
+
+(Leave out the `--prerelease` flag as necessary.)
+
+[setuptools-scm]: https://pypi.org/project/setuptools-scm/
+[twine]: https://pypi.org/project/twine/
+[github-cli]: https://cli.github.com/
+
+
+%prep
+%autosetup -n pytest-aoc-1.22.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-aoc -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 1.22.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..0939d4e
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+45fe7180487f77420421225cb5d2426f pytest-aoc-1.22.0.tar.gz