Commit Graph

3210 Commits

Author SHA1 Message Date
Dave Halter 78a53bf005 Change a test slightly 2022-11-12 13:59:07 +01:00
Dave Halter 8485df416d Finally fix a Django test 2022-11-11 18:00:17 +01:00
Dave Halter f454989859 Now that ClassVars work differently fix a Django test 2022-11-11 17:52:35 +01:00
Dave Halter e779f23ac7 Another small change towards tests 2022-11-11 17:50:05 +01:00
Dave Halter 3c40363a39 Remove another test that depends on specific pytest versions and is well covered by other tests 2022-11-11 17:47:02 +01:00
Dave Halter a6cf2c338a Remove part of a test that is annoying to develop 2022-11-11 17:44:49 +01:00
Dave Halter 804e4b0ca2 Merge pull request #1861 from qmmp123/master
Fix: #1847
2022-11-11 16:00:39 +00:00
Dave Halter 9723a0eed0 Merge pull request #1879 from marciomazza/find-external-pytest-fixtures
Find external pytest fixtures
2022-11-11 15:46:40 +00:00
Alex Ford 4d1e00c3ab Skip if attrs not in target environment.
Add check for attrs in test environment and skip if not installed.
This is patterned off the existing django tests.
2022-10-13 00:43:29 -07:00
Alex Ford e15f51ecc1 Remove mutable from attrs signature tests 2022-10-11 17:55:57 -07:00
Alex Ford 40e1e3f560 Extend dataclass constructor hinting to attrs next-gen apis.
Trivially extends dataclass constructor hinting to attrs next-gen APIs.

This will stumble in cases where attrs extends beyond the standard
dataclasses API, such as complex use of defaults, converters, et al.
However, it likely covers the vast majority of cases which fall solidly
in the intersection of the two APIs.

Extension beyond these cases could use [PEP0681 dataclass_transforms],
however this is definitely a problem for another day.

[PEP0681 dataclass_transforms]: https://peps.python.org/pep-0681/

https://github.com/davidhalter/jedi/issues/1835
2022-10-11 17:40:31 -07:00
Marcio Mazza e25750ecef Make code compatible with python < 3.8 2022-09-05 17:05:11 -03:00
Marcio Mazza 1a306fddbf Fix check pytest fixture from import on the right context 2022-09-04 13:12:13 -03:00
Marcio Mazza ec425ed2af Add tests to find pytest fixtures from external plugins 2022-09-03 17:16:32 -03:00
Marcio Mazza fa0c064841 Fix skipped collection of pytest integration test files
On integration tests file collection,
the value of `environment.executable` can also be a symlink
(e.g. in a virtualenv) with a different name than,
but pointing to the same as `sys.executable`
(e.g. .../bin/python3.10 and .../bin/python, respectively).

That causes skipping the collection of `completion/pytest.py`
and `completion/conftest.py` a lot of times, depending on the environment.
(e.g. "60 skipped" before x "23 skipped" after, in a local virtualenv)
2022-09-02 14:23:38 -03:00
Marcio Mazza 85c7f14562 Fix test where home could be a potential project 2022-09-01 13:01:27 -03:00
nedilmark e194ab5951 Fix: #1847 2022-06-18 06:13:07 +08:00
GalaxySnail 8cb1b76ea4 Fix typo 2022-04-14 04:02:20 +08:00
GalaxySnail e7755651a4 Add some tests for PEP 604 2022-04-14 03:32:43 +08:00
Dave Halter 8f15f38949 Revert a change for Python 2.7 compatibility (see also e267f63657) 2021-12-25 14:08:44 +01:00
Dave Halter 96af7e4077 The Python 3.6 requirement is now the lowest supported version 2021-12-25 13:37:35 +01:00
Dave Halter 929fa9b452 Fix a small issue in overload tests 2021-12-25 13:18:58 +01:00
Peter Law b6f761f13c Make typed decorators work for instance methods
This feels incomplete when compared to FunctionMixin.py__get__,
however seems to work at least in the cut-down reported.

Fixes https://github.com/davidhalter/jedi/issues/1801.
2021-12-12 18:18:55 +00:00
Peter Law 72cf41f4c9 Lambdas in comprehensions need parentheses in Python > 3.8
Fixes https://github.com/davidhalter/jedi/issues/1824.
2021-12-12 18:17:53 +00:00
Dave Halter a276710f66 Merge pull request #1820 from davidhalter/changes
Some Changes for 0.18.1
2021-11-17 01:42:55 +01:00
jerluc b2e647d598 Removing invalid test for async with open(...)
See explanation in https://github.com/davidhalter/jedi/pull/1819#issuecomment-970776091
2021-11-16 16:12:43 -08:00
Dave Halter ec9b453379 Handle defined_names for values that have no context, fixes #1744, fixes #1745 2021-11-17 01:07:28 +01:00
Dave Halter 84d086a47b Fix an issue with whitespace after a dot at the end of a file, also part of #1748 2021-11-17 00:31:46 +01:00
Dave Halter 8bc9c8cda2 Fix an issue where a slice is indexed, fixes #1748 2021-11-17 00:14:59 +01:00
Dave Halter a17b958078 Fix infer_default for params in REPL, fixes #1738 2021-11-16 23:36:22 +01:00
Dave Halter 6fa91726bf Fix a test in Python 3.10 that's not really important anyway 2021-11-16 23:08:05 +01:00
Dave Halter 42508d9309 Fix fixture annotations for pytest
This means mostly these:

@fixture
def foo() -> Generator[int, None, None]: ...
2021-11-16 22:57:25 +01:00
jerluc 8847848a03 Adds support for "async with" via #1818 2021-11-16 13:00:24 -08:00
Dave Halter e580d1f4d9 Fix a stub docs issue 2021-11-16 21:27:00 +01:00
Dave Halter 42c5276e04 Merge pull request #1800 from Boerde/pytest_improve_fixture_completion
Improve completion for pytest fixtures
2021-11-16 21:09:35 +01:00
Kirat Singh 53e837055f fix(import): support for nested namespace packages
If multiple directories in sys.path provide a nested namespace
package, then jedi would only visit the first directory which
contained the package.  Fix this by saving the remaining path list in
the ImplicitNamespaceValue and add a test for it.
2021-10-02 04:09:27 +00:00
Lumír 'Frenzy' Balhar eab1b8be8b inspect now raises OSError for objects without source file
CPython issue: https://bugs.python.org/issue44648
2021-09-01 20:50:54 +02:00
boerde 8808b5b64b added test to override fixture return value with annotation 2021-08-29 09:14:29 +02:00
Laurent Soest 96b4330ef9 testing: added test to override generator with annotation 2021-08-28 21:02:45 +02:00
Peter Law 78a95f4751 Handle generics appearing within any quoted annotations
This hoists the solution added for return-type annotations to
also apply for input annotations so they work too.
2021-07-25 16:31:27 +01:00
Peter Law 599a1c3ee1 Handle generics appearing within quoted return annotations
This ensures that these quoted likely forwards references in
return type annotations behave like their non-quoted equivalents.

I suspect there may be other places which will need similar
adjustments, which may mean that we should push the conversion
a layer closer to the parsing (perhaps in `py__annotations__`?).

One case I know that this doesn't solve (but which likely needs
similar adjustment) is generics in return types of comment-style
annotations. They're less likely and may not be worth supporting
since all supported Python versions can use the in-syntax spelling
for annotations at this point.
2021-07-25 15:32:22 +01:00
Peter Law 6787719c28 Ensure *args, **kwargs lookthrough works at module scope too
This means that passthrough signatures will be found for top level
functions, which is useful both where they're wrappered by
`functools.wraps` or not.

Fixes https://github.com/davidhalter/jedi/issues/1791.
2021-07-24 16:58:34 +01:00
Peter Law bb40390225 Add identifiers to these test strings
This makes it easier to work out which one fails when pytest
reports a failure. Mostly useful when introducing failing tests,
which I'm about to do.
2021-07-24 16:15:41 +01:00
Peter Law 0d15347210 Remove confusing comment
I'm assuming that this is incorrect given that there _are_ arguments
where the comment suggests there aren't any.
2021-07-24 16:14:20 +01:00
Joseph Birkner a340fe077e Fixed ZIP completion. 2021-04-29 09:52:08 +02:00
Dave Halter 387d73990b Fix issues with getitem on compiled objects that have annotations, see #1719 2021-01-17 13:48:22 +01:00
Dave Halter 47d0318fa6 Paths are the default for modules 2021-01-14 02:00:14 +01:00
Dave Halter 2a8b212af7 Move the module_injector 2021-01-14 01:35:18 +01:00
Dave Halter 837cb1106a Use Path instead of str if possible 2021-01-14 01:32:57 +01:00
Dave Halter b6fd81f1e1 Another time avoiding a memory leak, also part of #1723 2021-01-14 01:18:00 +01:00