Metadata-Version: 2.1
Name: pytest-aoc
Version: 1.2a6
Summary: Downloads puzzle inputs for Advent of Code and synthesizes PyTest fixtures
Home-page: https://github.com/j0057/pytest-aoc
Author: Joost Molenaar
Author-email: j.j.molenaar@gmail.com
License: UNKNOWN
Description: # pytest-aoc
        
        This pytest plugin downloads puzzle inputs for [Advent of Code][1] and
        synthesizes fixtures that you can use in your tests.
        
        [1]: https://adventofcode.com/
        
        ## 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`)
        
        ## Developing/testing/releasing
        
        So this is a pytest plugin that 1) changes the filesystem, 2) based on the
        current time, 3) with stuff downloaded from the internet. Code coverage should
        be 100% of course.
        
        Fortunately, pytest and friends are fantastic:
        
        - **pytest** has a built-in `testdir` fixture for dealing with the file system
          and testing pytest plugins
        - **pytest-cov** ensures code coverage is 100%
        - **pytest-freezegun** sets the date to a known moment
        - **pytest-responses** makes **requests** return known responses
        
        ### Development environment
        
        You need an editable install of the package, with the `dev` extras:
        
        - Uninstall any current version: `python -m pip uninstall -y pytest-aoc`
        - Install an editable version: `python -m pip install .[dev]`
        
        ### Testing
        
        That is easy and luxurious: just run `pytest`.
        
        ### Releasing
        
        This is currently a very involved process:
        
        - Tag a version: `git tag -a 1.2.3`
        - Bake an sdist: `./setup.py sdist`
        - Bake a wheel: `./setup.py bdist_wheel`
        - Push the tag to Github: `git push --tags github`
        - Publish build artifacts to Github with githubrelease
        - Publish build artifacts to PyPI with twine
        
        ...I would really like to automate it using Github Actions, but I'm afraid
        that's getting nixed by Microsoft due to Github Actions being fundamentally
        much cooler than Azure Pipelines.
        
Platform: UNKNOWN
Classifier: Framework :: Pytest
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown
Provides-Extra: dev
