Commit Graph

52 Commits

Author SHA1 Message Date
Bruno Oliveira fbba504cd5 Allow pluggy >=1.0
Now that pluggy 1.0 has been released, we can allow pluggy 1.0 with new pytest versions.
2021-08-26 09:26:51 -03:00
Anthony Sottile fa42be77a6
Remove upper pinning on tomli
the best practice is to only `<` when you know something is broken, and even then prefer `!=` assuming it will be fixed upstream for maximum compatibility
2021-07-09 10:09:05 -04:00
Taneli Hukkinen e942b12b94 Support TOML v1.0.0 syntax in `pyproject.toml` 2021-07-06 00:26:01 +03:00
Anthony Sottile 0341893512
Merge pull request #8584 from nicoddemus/pygments-testing-extra
Make pygments part of 'testing' extras
2021-04-24 19:55:13 -07:00
Bruno Oliveira c9e30a7035 Make pygments part of 'testing' extras
Tests in test_terminalwriter depend on pygments being installed
to work, so it should be installed with the `testing` extras.
2021-04-24 10:11:47 -03:00
Dominic Davis-Foster f9d1fa4c4b
Remove "upload_sphinx" section from setup.cfg
The `Sphinx-PyPI-upload` tool the section corresponds to hasn't been updated since 2009, and the new (c. 2018) PyPI doesn't support documentation uploads anyway.
2021-04-21 16:46:28 +01:00
Bruno Oliveira a7416a535a Add classifier for Python 3.10 and CHANGELOG entry 2021-03-27 11:13:16 -03:00
Ran Benita 8c350b9837 setup.cfg: fix setuptools dash-separator warnings
Warnings like this:

python3.9/site-packages/setuptools/dist.py:634: UserWarning: Usage of
dash-separated 'upload-dir' will not be supported in future versions.
Please use the underscore name 'upload_dir' instead
2021-03-13 20:30:24 +02:00
Sylvain Bellemare 3d831225bb
Remove duplicate '>=' in setup.cfg 2021-02-10 22:17:39 +00:00
Adam Johnson bd894e3065
Add Changelog to setup.cfg (#8166)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-12-17 13:55:36 -03:00
Anton cf1051cfba
infrastructure: Stricter tox dependensies (#8119) 2020-12-12 18:08:15 +02:00
Ran Benita de810152ec tox: remove checkqa-mypy environment
We run mypy through pre-commit, and we don't keep duplicate targets in
tox for all of the other linters. Since this adds some (small)
maintenance overhead, remove it.
2020-10-28 22:16:25 +02:00
Ran Benita 1b23a111d2 Update mypy 0.782 -> 0.790 2020-10-17 19:25:45 +03:00
Anthony Sottile 3c93eb0f04 py36+: remove pathlib2 compatibility shim 2020-10-02 14:59:07 -07:00
Anthony Sottile 179f4326df py36+: drop python3.5 in CI and setup.cfg 2020-10-02 14:00:11 -07:00
Ran Benita 32bb8f3a63 Bump attrs requirement from >=17.4.0 to >=19.2.0
This allows us to remove the `ATTRS_EQ_FIELD` thing which is causing
some annoyance.
2020-09-27 13:17:59 +03:00
Ran Benita 9ab14c6d9c typing: set warn_unreachable
This makes mypy raise an error whenever it detects code which is
statically unreachable, e.g.

    x: int
    if isinstance(x, str):
        ... # Statement is unreachable  [unreachable]

This is really neat and finds quite a few logic and typing bugs.

Sometimes the code is intentionally unreachable in terms of types, e.g.
raising TypeError when a function is given an argument with a wrong
type. In these cases a `type: ignore[unreachable]` is needed, but I
think it's a nice code hint.
2020-08-04 09:59:46 +03:00
Ran Benita be656dd4e4 typing: set disallow_any_generics
This prevents referring to a generic type without filling in its generic
type parameters.

The FixtureDef typing might need some more refining in the future.
2020-08-01 20:39:15 +03:00
Bruno Oliveira 6882c0368b
Merge pull request #7593 from bluetech/typing-no-implicit-reexport
typing: set no_implicit_reexport
2020-08-01 11:03:47 -03:00
Ran Benita 8d98de8f8a typing: set no_implicit_reexport
In Python, if module A defines a name `name`, and module B does `import
name from A`, then another module C can `import name from B`.

Sometimes it is intentional -- module B is meant to "reexport" `name`.
But sometimes it is just confusion/inconsistency on where `name` should
be imported from.

mypy has a flag `--no-implicit-reexport` which puts some order into
this. A name can only be imported from a module if

1. The module defines the name
2. The module's `__all__` includes the name
3. The module imports the name as `from ... import .. as name`.

This flag is included in mypy's `--strict` flag.

I like this flag, but I realize it is a bit controversial, and in
particular item 3 above is a bit unfriendly to contributors who don't
know about it. So I didn't intend to add it to pytest.

But while investigating issue 7589 I came upon mypy issue 8754 which
causes `--no-implicit-reexport` to leak into installed libraries and
causes some unexpected typing differences *in pytest* if the user uses
this flag.

Since the diff mostly makes sense, let's just conform to it.
2020-07-31 10:09:11 +03:00
Ran Benita 96a48f0c66 Stop using more-itertools
We barely use it; the couple places that do are not really worth the
extra dependency, I think the code is clearer without it.

Also simplifies one (regular) itertools usage.

Also improves a check and an error message in `pytest.raises`.
2020-07-30 20:19:24 +03:00
Ran Benita 2bcad38fbd Publish our types 2020-07-04 13:18:15 +03:00
Ran Benita c27550731d Require py>=1.8.2 so we can rely on correct hash() of py.path.local on Windows
See https://github.com/pytest-dev/py/blob/1.8.2/CHANGELOG#L4.
Fixes #7357.
2020-06-15 19:36:38 +03:00
Bruno Oliveira c17d50829f
Add pyproject.toml support (#7247) 2020-06-08 10:03:10 -03:00
Ran Benita 54ad048be7 Enable check_untyped_defs mypy option for testing/ too 2020-06-05 11:34:20 +03:00
Ran Benita 71dfdca4df Enable check_untyped_defs mypy option for src/
This option checks even functions which are not annotated. It's a good
step to ensure that existing type annotation are correct.

In a Pareto fashion, the last few holdouts are always the ugliest,
beware.
2020-06-05 11:34:20 +03:00
Anthony Sottile 789eea2464 Run setup-py-upgrade and setup-cfg-fmt
- also ran `pre-commit autoupdate`
- https://github.com/asottile/setup-py-upgrade
- https://github.com/asottile/setup-cfg-fmt
2020-06-04 09:58:58 -07:00
Ran Benita 857b5c9ccd
Merge pull request #7185 from bluetech/sigpipe
Handle SIGPIPE/BrokenPipeError in pytest's CLI
2020-05-08 13:32:34 +03:00
Ran Benita 73448f265d Handle EPIPE/BrokenPipeError in pytest's CLI
Running `pytest | head -1` and similar causes an annoying error to be
printed to stderr:

    Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
    BrokenPipeError: [Errno 32] Broken pipe

(or possibly even a propagating exception in older/other Python versions).

The standard UNIX behavior is to handle the EPIPE silently. To
recommended method to do this in Python is described here:
https://docs.python.org/3/library/signal.html#note-on-sigpipe

It is not appropriate to apply this recommendation to `pytest.main()`,
which is used programmatically for in-process runs. Hence, change
pytest's entrypoint to a new `pytest.console_main()` function, to be
used exclusively by pytest's CLI, and add the SIGPIPE code there.

Fixes #4375.
2020-05-08 12:51:02 +03:00
Anthony Sottile dad328bc8a Fix tests for python3.9 2020-05-07 05:26:55 -07:00
Daniel Hahler d017b69f38 mypy: show_error_codes=True 2020-01-27 22:18:35 +01:00
Hugo fe343a79f8 Remove deprecated license_file from setup.cfg
Starting with wheel 0.32.0 (2018-09-29), the `license_file` option is deprecated.

* https://wheel.readthedocs.io/en/stable/news.html

The wheel will continue to include `LICENSE`, it is now included automatically:

* https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file

And `LICENSE` is still included in sdists thanks to setuptools-scm:

* https://github.com/pytest-dev/pytest/pull/6348#issuecomment-567836331
2020-01-25 17:08:00 +02:00
Bruno Oliveira e5bd7fb053 Convert pytest.py into a package
As discussed in https://github.com/pytest-dev/pytest/issues/3342, this
is the first step to make pytest support static typing fully
2019-12-02 19:27:11 -03:00
Daniel Hahler b461010f32 mypy: config: use mypy_path=src
This allows for checking files inside of "testing" without having
"src/…" as an argument also.
2019-11-18 18:12:59 +01:00
Daniel Hahler 41604eeb3e setup.cfg: fix check-manifest ignore [ci skip] 2019-11-08 22:39:39 +01:00
Ran Benita 89dfde9535 Add rudimentary mypy type checking
Add a very lax mypy configuration, add it to tox -e linting, and
fix/ignore the few errors that come up. The idea is to get it running
before diving in too much.

This enables:

- Progressively adding type annotations and enabling more strict
  options, which will improve the codebase (IMO).

- Annotating the public API in-line, and eventually exposing it to
  library users who use type checkers (with a py.typed file).

Though, none of this is done yet.

Refs https://github.com/pytest-dev/pytest/issues/3342.
2019-07-09 12:12:07 -07:00
Bruno Oliveira 4d49ba6529 Drop Python 2.7 and 3.4 support
* Update setup.py requires and classifiers
* Drop Python 2.7 and 3.4 from CI
* Update docs dropping 2.7 and 3.4 support
* Fix mock imports and remove tests related to pypi's mock module
* Add py27 and 34 support docs to the sidebar
* Remove usage of six from tmpdir
* Remove six.PY* code blocks
* Remove sys.version_info related code
* Cleanup compat
* Remove obsolete safe_str
* Remove obsolete __unicode__ methods
* Remove compat.PY35 and compat.PY36: not really needed anymore
* Remove unused UNICODE_TYPES
* Remove Jython specific code
* Remove some Python 2 references from docs

Related to #5275
2019-06-02 14:39:11 -03:00
Anthony Sottile 0c6ca0da62 Fix usages of py.io.saferepr 2019-01-20 16:36:23 -08:00
Ronny Pfannschmidt 456715a5c1 fix url quotes in setup.cfg metadata 2018-10-16 21:48:39 +02:00
Ronny Pfannschmidt 7855284ef7 move most setuptools parameters over to setup.cfg 2018-10-15 07:30:07 +02:00
Ronny Pfannschmidt d4351ac5a2 modernize packaging for setuptools>30.3 2018-10-14 21:44:32 +02:00
Ronny Pfannschmidt e02cb6d7ce restore setuptools_scm write_to usage 2017-04-23 16:59:08 +02:00
Philippe Ombredanne aa82db9fe2 Ensure the LICENSE is included in built wheels
Otherwise it is not included by default as wheels do not honor the MANIFEST.in

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
2017-01-10 19:25:57 +01:00
holger krekel fe897c81be configure a plain "devpi upload" to create sdist and universal wheel 2015-07-09 14:56:56 +02:00
Ionel Cristian Maries b7d43c5a5d Add support for building proper wheels (universal and proper dependency evnironment markers for argparse/colorama if setuptools is new-ish).
--HG--
branch : pytest-2.7
2015-04-10 21:08:50 +03:00
holger krekel 97c9c10f3c remove "universal wheel" again until the py26/py27 difference (argparse) does not play a role anymore. 2014-10-25 07:21:21 +02:00
Alex Gaynor 5a88a9b22a Mark pytest as a universal wheel
--HG--
branch : alex_gaynor/mark-pytest-as-a-universal-wheel-1414169551518
2014-10-24 16:52:43 +00:00
sontek@gmail.com 0ea46e6aef Removed marking pytest as universal, py26 and py27 are not compatible.
--HG--
branch : fix_universal
2014-08-21 12:47:53 -07:00
Alex Gaynor b7d046527e Marked pytest as being a universal wheel.
--HG--
branch : alex_gaynor/marked-pytest-as-being-a-universal-wheel-1405267754279
2014-07-13 16:09:24 +00:00
holger krekel 263b0e7d99 add setup.cfg for building sphinx_docs 2013-10-03 12:35:13 +02:00