Age | Commit message (Collapse) | Author |
|
* [pre-commit.ci] pre-commit autoupdate
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* manual fixes after configuration update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Anthony Sottile <asottile@umich.edu>
|
|
|
|
|
|
|
|
This indicates at least for people using type checkers that these
classes are not designed for inheritance and we make no stability
guarantees regarding inheritance of them.
Currently this doesn't show up in the docs. Sphinx does actually support
`@final`, however it only works when imported directly from `typing`,
while we import from `_pytest.compat`.
In the future there might also be a `@sealed` decorator which would
cover some more cases.
|
|
|
|
terminalwriter: bring back handling of printing characters not supported by stdout
|
|
Some minor fixes & type annotations
|
|
stdout
|
|
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
|
|
Not needed since pyflakes 2.2.0.
|
|
Co-authored-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
`TerminalWriter`, imported recently from `py`, contains its own
incomplete wcwidth (`char_with`/`get_line_width`) implementation. The
`TerminalReporter` also needs this, but uses the external `wcwidth`
package.
This commit brings the `TerminalWriter` implementation up-to-par with
`wcwidth`, moves to implementation to a new file `_pytest._io.wcwidth`
which is used everywhere, and removes the dependency.
The differences compared to the `wcwidth` package are:
- Normalizes the string before counting.
- Uses Python's `unicodedata` instead of vendored Unicode tables. This
means the data corresponds to the Python's version Unicode version
instead of the `wcwidth`'s package version.
- Apply some optimizations.
|
|
|
|
Fix #7145
|
|
|
|
|
|
Currently this property is computed eagerly, which means
get_line_width() is computed on everything written, but that is a slow
function.
Compute it lazily, so that get_line_width() only runs when needed.
|
|
|
|
Flushing on every write is somewhat expensive.
Rely on line buffering instead (if line buffering for stdout is
disabled, there must be some reason...), and add explicit flushes when
not outputting lines.
This is how regular `print()` e.g. work so should be familiar.
|
|
|
|
|
|
|
|
On Windows we already depend on colorama, which takes care of all of
this custom code on its own.
|
|
Doesn't add much.
|
|
Had a mark indicating it should be removed, and I agree, it's better to
just use the `file` argument.
|
|
Previously it extended an external type but now it come move to the type
itself.
|
|
Not used.
|
|
|
|
|
|
It is not used and slows things down.
|
|
This function is called a lot when printing a lot of text, and is very
slow -- this speeds it up a bit.
|
|
The shutil.get_terminal_size() handles everything this did already.
|
|
Python 3 does this on its own so we can use the shared code:
https://github.com/python/cpython/commit/bcf2b59fb5f18c09a26da3e9b60a37367f2a28ba
|
|
This way non-Windows platforms skip it. It also uses things defined
inside the `if`.
|
|
|
|
|
|
Straight copy from py 1.8.1. Doesn't pass linting yet.
|
|
|
|
|
|
* Use code highlighting if pygments is installed
* Use colorama constants instead of bare ascii codes
Could not find the exact equivalent of 'hl-reset' code using colorama
constants though.
* Refactor ASCII color handling into a fixture
* Revert back to using explicit color codes
* In Python 3.5 skip rest of tests that require ordered markup in colored output
|
|
Conflicts:
src/_pytest/_code/code.py
src/_pytest/main.py
|
|
This also imports `TerminalWriter` explicitly via `_pytest._io`,
allowing for easier extending / replacing it.
|
|
|
|
This causes INTERNALERRORs with pytest-django, which uses
`pytest.fail` (derived from `BaseException`) to prevent DB access, when
pytest then tries to e.g. display the `repr()` for a Django `QuerySet`
etc.
Ref: https://github.com/pytest-dev/pytest-django/pull/776
|
|
|
|
The DRY savings they provide are rather small, while they make it harder
to type-check, and IMO harder to understand.
|
|
max_other is used by the superclass repr_instance, but we override it
and use maxsize instead.
|
|
This will be easier to type-check, and also somewhat clearer.
|