pip/tests/yaml
Pradyun Gedam 3f88476e4f
This counts as a fix right?
2020-07-27 20:06:55 +05:30
..
ERRORS.md add errors draft 2020-06-15 15:34:35 +08:00
README.md add test for unavailable version 2020-06-15 15:34:35 +08:00
backtrack.yml add backtracking resolver yaml test 2020-04-26 14:09:27 -05:00
circular.yml add error checks - run circular tests with new resolver 2020-06-15 15:34:36 +08:00
conflict_1.yml This counts as a fix right? 2020-07-27 20:06:55 +05:30
conflict_2.yml Fix YAML tests to reflect the new resolver error 2020-06-25 15:00:21 +08:00
conflict_3.yml add triangle conflict test 2020-06-15 15:34:34 +08:00
conflicting_diamond.yml Fix YAML tests to reflect the new resolver error 2020-06-25 15:00:21 +08:00
conflicting_triangle.yml Make the YAML tests happier 2020-07-27 13:49:21 +05:30
extras.yml yaml test extras-2 passws with new resolver 2020-04-22 17:45:08 -05:00
fallback.yml add fall back test 2020-06-15 15:34:34 +08:00
huge.yml Rename CFFI for PyPy 2020-06-15 15:47:38 +08:00
large.yml Fix YAML tests to reflect the new resolver error 2020-06-25 15:00:21 +08:00
linter.py check for stderr regex in linter 2020-06-15 15:34:37 +08:00
non_pinned.yml move yaml test files up one level 2020-04-22 15:23:35 -05:00
overlap1.yml add comment 2020-04-24 23:11:35 -05:00
pinned.yml move yaml test files up one level 2020-04-22 15:23:35 -05:00
pip988.yml update link to refer directly to benoit-pierre's comment 2020-04-25 20:00:44 -05:00
poetry2298.yml add test for https://github.com/python-poetry/poetry/issues/2298 2020-04-23 22:40:53 -05:00
simple.yml add ability to install list of requirements - with example in simple.yml 2020-04-28 23:32:55 -05:00
trivial.yml add trivial example to demonstrate installing and uninstalling multiple packages 2020-04-29 00:12:02 -05:00

README.md

YAML tests for pip's resolver

This directory contains fixtures for testing pip's resolver. The fixtures are written as .yml files, with a convenient format that allows for specifying a custom index for temporary use.

The .yml files are typically organized in the following way. Here, we are going to take a closer look at the simple.yml file and step through the test cases. A base section defines which packages are available upstream:

base:
  available:
    - simple 0.1.0
    - simple 0.2.0
    - base 0.1.0; depends dep
    - dep 0.1.0

Each package has a name and version number. Here, there are two packages simple (with versoin 0.1.0 and 0.2.0). The package base 0.1.0 depends on the requirement dep (which simply means it depends on any version of dep. More generally, a package can also depend on a specific version of another package, or a range of versions.

Next, in our yaml file, we have the cases: section which is a list of test cases. Each test case has a request and a response. The request is what the user would want to do:

cases:
-
  request:
    - install: simple
    - uninstall: simple
  response:
    - state:
      - simple 0.2.0
    - state: null

Here the first request is to install the package simple, this would basically be equivalent to typing pip install simple, and the corresponding first response is that the state of installed packages is simple 0.2.0. Note that by default the highest version of an available package will be installed.

The second request is to uninstall simple again, which will result in the state null (basically an empty list of installed packages).

When the yaml tests are run, each response is verified by checking which packages got actually installed. Note that this is check is done in alphabetical order.

The linter is very useful for initally checking .yml files, e.g.:

$ python linter.py -v simple.yml

To run only the yaml tests, use (from the root of the source tree):

$ tox -e py38 -- -m yaml -vv

Or, in order to avoid collecting all the test cases:

$ tox -e py38 -- tests/functional/test_yaml.py

Or, only a specific test:

$ tox -e py38 -- tests/functional/test_yaml.py -k simple

Or, just a specific test case:

$ tox -e py38 -- tests/functional/test_yaml.py -k simple-0