Skip to content

Developer docs on running tests should focus on pytest #3399

Closed

Description

@gnprice

Our type-checking unit tests all run under pytest, and some others run under myunit.

For doing development, one generally pretty quickly wants to start running individual tests, or passing flags like py.test --verbose, -s, or -x/--exitfirst. That means running py.test directly, or running myunit directly for those tests that are under myunit. (There is a way to wrap them to send through runtests.py, but that's more complicated.)

Currently the mention in test-data/unit/README.md of running pytest directly is short and easy to gloss over. We should make it more of a focus.

Activity

  1. JukkaL commented on May 22, 2017

    @JukkaL
    Collaborator

    Other things that would be worth mentioning prominently:

    • pytest -k SUBSTRING to narrow down which tests to run
    • pytest -n0 -k ... to run sequentially (can be much faster when running only a few tests)

    Also, pytest seems to be preferred over py.test these days (https://stackoverflow.com/questions/39495429/py-test-vs-pytest-command) and it's a little faster to type as a bonus.

  2. gnprice commented on May 22, 2017

    @gnprice
    CollaboratorAuthor

    Also, pytest seems to be preferred over py.test these days

    TIL! I didn't even know you could say pytest as a command line.

    For me it's actually a little slower / more annoying to test -- pyte<TAB> vs py.<TAB>. But I definitely appreciate having just one name to say rather than two slightly different names that apply in different contexts.

  3. hauntsaninja commented on Aug 7, 2020

    @hauntsaninja
    Collaborator

    This issue is very old and https://github.com/python/mypy/blob/master/test-data/unit/README.md seems to currently covers these, so closing. But documentation can always be improved, so would look at a PR :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions