Ran Benita
4a27d7d973
code/source: remove unused method Source.putaround()
2020-07-01 20:20:11 +03:00
Ran Benita
a7303b52db
code/source: remove unused method Source.isparseable()
2020-07-01 20:20:11 +03:00
Ran Benita
a127a22d13
code/source: remove support for comparing Source with str
...
Cross-type comparisons like this are a bad idea. This isn't used.
2020-07-01 20:20:10 +03:00
Ran Benita
4108174777
code/source: remove Source(deindent: bool) parameter
...
Not used, except in tests.
2020-07-01 20:20:07 +03:00
Bruno Oliveira
55099e57c3
Add requested comment as per review
2020-05-19 19:20:41 -03:00
Daniel Hahler
b98a182aa1
(no) coverage
2020-05-19 19:20:41 -03:00
Daniel Hahler
61180eec93
Test behavior of Source with regard to decorators
...
Unlinke `inspect.getsource` it does not unwrap functions.
2020-05-19 19:20:41 -03:00
Anthony Sottile
dad328bc8a
Fix tests for python3.9
2020-05-07 05:26:55 -07:00
Daniel Hahler
61f2a26675
Code/getfslineno: keep empty co_filename
...
Previously this would be turned via `py.path.local("")` into the current
working directory.
This appears to be what `fspath = fn and py.path.local(fn) or None`
tries to avoid in `getfslineno`'s `TypeError` handling already, if
`Code` would raise it.
2020-02-03 19:09:08 +01:00
Daniel Hahler
78eddcb5b1
tests: move test_getfslineno back
...
Reverts https://github.com/pytest-dev/pytest/pull/6610 .
The tested `getfslineno` is `src/_pytest/_code/source.py` actually,
exported via `src/_pytest/_code/__init__.py`.
I've confused it with the one in `src/_pytest/compat.py` apparently.
2020-01-29 23:47:39 +01:00
Daniel Hahler
a3f482ceba
tests: move test_getfslineno
...
It should be in `test_code` when testing `_pytest._code.getfslineno`,
not to be confused with `_pytest._code.source.getfslineno`.
Adds an extra assert (via https://github.com/pytest-dev/pytest/pull/6590 ).
2020-01-29 01:26:10 +01:00
Ran Benita
0c247be769
Add a few missing type annotations in _pytest._code
...
These are more "dirty" than the previous batch (that's why they were
left out). The trouble is that `compile` can return either a code object
or an AST depending on a flag, so we need to add an overload to make the
common case Union free. But it's still worthwhile.
2020-01-19 19:39:14 +02:00
Ran Benita
090e260517
master: update mypy 0.740 -> 0.761
...
(cherry picked from commit 16ff9f591e
)
(cherry picked from commit 4848bbdf9a
)
2020-01-14 06:31:41 +01:00
Ran Benita
eaa34a9df0
Add type annotations to _pytest._code.code
2019-11-16 22:29:57 +02:00
Ran Benita
5bfe793fd5
Remove unneeded getrawcode() calls from tests
2019-11-16 17:22:08 +02:00
Daniel Hahler
cb21a8db1d
test_source: do not instantiate Source objects during collection
2019-11-07 11:44:26 +01:00
Anthony Sottile
be2be040f9
Clean up u' prefixes and py2 bytes conversions
2019-06-04 17:50:34 -07:00
Anthony Sottile
8292644015
Allow multiple positions for the SyntaxError in pypy3.6
2019-06-03 12:08:02 -03:00
Anthony Sottile
5dcf85c17e
manual: remove dependence on six
2019-06-03 12:08:02 -03:00
Anthony Sottile
a91fe1fedd
pre-commit run pyupgrade --all-files
2019-06-03 12:08:02 -03:00
Anthony Sottile
3f1ec520fc
pre-commit run reorder-python-imports --all-files
2019-06-03 12:08:01 -03:00
Anthony Sottile
5034399d7a
pre-commit run fix-encoding-pragma --all-files
2019-06-03 12:08:01 -03: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
Bruno Oliveira
465b2d998a
Further "unknown marks warning" improvements ( #5178 )
...
Further "unknown marks warning" improvements
2019-05-11 13:28:10 -03:00
Bruno Oliveira
0594dba5ce
Remove unused markers and enable --strict-markers
2019-05-09 19:36:39 -03:00
Anthony Sottile
d1a48ad68f
Use exec directly
2019-05-06 23:07:39 -07:00
Daniel Hahler
8011ff5bda
Add _sys_snapshot fixture and use it with more tests
2019-04-05 11:55:23 +02:00
Daniel Hahler
0d31e852b1
Run isort
2019-03-01 14:24:18 +01:00
Anthony Sottile
5505826db9
Fix python3.8 / pypy failures
2019-02-16 11:23:23 -08:00
Anthony Sottile
1bba0a9714
Deprecate `raises(..., 'code(as_a_string)')` / `warns(..., 'code(as_a_string)')
2018-11-29 09:34:51 -08:00
Anthony Sottile
2368fbb63c
Apply reorder-python-imports to all files
2018-10-25 00:01:29 -07:00
Anthony Sottile
b8b9e8d41c
Remove duplicate test (tested above)
2018-10-03 10:01:06 -07:00
Anthony Sottile
f102ccc8f0
Fix source reindenting by using `textwrap.dedent` directly.
2018-10-02 16:13:35 -07:00
Bruno Oliveira
bc009a8582
Fix test to comply with pypy 6.0
2018-10-01 18:37:27 -03:00
Anthony Sottile
1e8e17c01e
Improve the coverage of testing/code
2018-08-26 16:13:22 -07:00
Anthony Sottile
c2cd337886
py.builtin.exec_ => six.exec_
2018-08-22 23:00:06 -07:00
Anthony Sottile
af0059079c
Remove unused fix-lint tox environment
2018-07-08 17:05:01 -07:00
Anthony Sottile
f940967e23
Fix test offset after black moved code
2018-06-26 06:35:48 -07:00
Anthony Sottile
cbaa7dd56a
Upgrade pre-commit hooks except pyupgrade
2018-06-26 06:35:27 -07:00
Ronny Pfannschmidt
d4bf2ff8f5
fix test_source
2018-05-23 18:22:18 +02:00
Ronny Pfannschmidt
703e4b11ba
run black
2018-05-23 16:48:46 +02:00
Anthony Sottile
bd1d17e8de
Replace py.std with stdlib imports
2018-01-09 12:44:10 -08:00
Srinivas Reddy Thatiparthy
c2cd239d35
remove _ast reference from test cases as well
2017-12-11 23:24:47 +05:30
Bruno Oliveira
983a09a2d4
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2017-11-10 18:33:02 -02:00
Bruno Oliveira
03829fde8a
Fix linting E741: ambiguous variable name
2017-11-04 13:59:10 -02:00
hugovk
ef732fc51d
Remove code for unsupported Python versions
2017-10-10 08:54:56 +03:00
Bruno Oliveira
abfd9774ef
Remove xfail mark from passing test in py26
2017-09-12 17:59:09 -03:00
Bruno Oliveira
22f54784c2
Add "fix-lint" tox environment to fix linting errors
2017-07-20 22:12:15 -03:00
Andras Tim
7248b759e8
Fixed E303 flake8 errors
...
too many blank lines (3)
2017-07-17 01:44:23 +02:00
Andras Tim
b840622819
Fixed E302 flake8 errors
...
expected 2 blank lines, found 0
2017-07-17 01:44:23 +02:00