Commit Graph

60 Commits

Author SHA1 Message Date
Liam Jarvis 72603dfdba fix: remove global print function call (#79)
This commit removes a call to an unknown print function call
2024-08-19 10:40:46 +01:00
Rónán Carrigan e5bff6dcf3 fix(pytest): handle failed setup
Previously we would only handle skipped setups, we need to handle failed
setups in cases of fixture lookup errors.

See #37
2024-08-14 16:21:33 +01:00
Rónán Carrigan 0ab9ad3570 feat: multiple adapter instances
Allows calling the module multiple times with different configs for use
in different in projects.
2024-08-14 14:31:43 +01:00
johnybx 2e83d2bc00 fix: - use --verbosity=0 when collecting pytest parametrized tests (#60) 2024-01-15 08:03:46 +00:00
Hao Nguyen 86ac2bbc8a fix: separate runner args (#62) 2023-12-22 19:39:11 +00:00
Rónán Carrigan 27a2676aa0 fix(pytest): handle parameterized tests without pytest discovery
Only emits position IDs with parameters when pytest discovery is enabled

See #36 and #59
2023-12-20 18:51:58 +00:00
Adrian Frischkorn 48bf141103 feat: django support. (#54) 2023-12-10 19:15:08 +00:00
Viktor Ashcheulov c969a5b007 feat: pass strategy to get_args (#57) 2023-11-12 11:02:02 +00:00
Daniel Watkins ff20740633 feat(pytest): populate parameterized test instances (#36)
Co-authored-by: Rónán Carrigan <rcarriga@tcd.ie>
2023-11-12 11:01:00 +00:00
Willem-J-an 81d2265efa fix(unittest): parse failing subtests (#53)
Co-authored-by: Willem Jan Noort <noortw01@heiway.net>
2023-08-25 11:17:04 +01:00
Sebastian Kohn 054f221294 fix: detect poetry env outside of poetry shell (#49)
If you are not in a `poetry shell`, the venv detection does not work. This patch
prepends `poetry run` before `poetry env info -p`, which makes venv detection
work both inside and outside the poetry subshell.
2023-07-04 20:45:45 +01:00
Rónán Carrigan 6c06041cfb fix(unittest): correct arg order for test vs suite
See #45
2023-02-18 09:34:37 +00:00
Rónán Carrigan 75fdeb460d fix(unittest): correctly order arguments
See #45
2023-02-17 08:10:16 +00:00
Rónán Carrigan dc36e8a857 fix(unittest): prepend executable name in args 2023-02-16 09:39:19 +00:00
Rónán Carrigan 4398ba1063 fix(unittest): handle error outside of file
If an error occurs outside of the test file, there is no frame to match
an error to. This can happen for example when required arguments are not
passed to the test.
2023-02-16 09:19:15 +00:00
Rónán Carrigan 1c06dfac57 fix(unittest): use parsed args
sys.argv should not have been used, switched to passed arguments

See #45
2023-02-16 09:18:13 +00:00
TheJoeSchr a76fb6760f docs(README): missing , (#44) 2023-02-07 08:34:47 +00:00
Daniel Watkins e53920d145 chore: styling (#38) 2022-11-22 09:41:45 +00:00
Rónán Carrigan 438744e274 fix(pytest): wrap pytest types 2022-11-10 14:57:14 +00:00
Daniel Watkins 16c3c90b55 feat(query): include test decorators in the test definition (#34)
This means that `neotest.run.run` when the cursor is on a test's
decorators will run the decorated test (instead of running the previous
test in the file, the current behaviour).

Fixes: #31
2022-11-10 08:41:54 +00:00
Daniel Watkins 52624d1306 refactor(pytest): move remaining imports to module-level (#32)
We introduced a module-level import dependency on pytest in #29: this
makes our importing consistent.
2022-11-10 08:23:16 +00:00
Daniel Watkins 458f35723f feat(pytest): prefix diagnostic messages with parameterized test ID (#33)
Given a test like:

```py
@pytest.mark.parametrize("a,b", [("b", "c"), ("c", "d")])
def test_a(a, b):
    assert False
```

This modifies the diagnostic message from:

```
neotest: assert False
neotest: assert False
```

to:

```

neotest: [b-c] assert False
neotest: [c-d] assert False
```

This is the same internal value which `pytest` uses for parametrized
instances in its output, so it should be fully consistent.

Without this, the diagnostic messages aren't very useful for
parametrized tests: you can't identify _which_ of the multiple test
which execute the given line are failing.

Fixes: #30
2022-11-10 08:22:04 +00:00
Daniel Watkins c85a02089d feat(pytest): use pytest_runtest_makereport for consistent exception handling (#29)
* include type of unhandled pytest exc_repr in error message

This makes triage of such issues a little simpler.

* pytest: expect the more general ExceptionRepr class

This is the (abstract) supertype of the currently-used
ExceptionChainRepr, and defines all of the attributes currently used by
the code.

(This changes results in sensible output for `ReprExceptionInfo`
instances, which is what my pytest invocations were generating.)

* pytest: use pytest_runtest_makereport for consistent exception handling

The `report` passed to `pytest_runtest_logreport` has a different
internal exception representation depending on the `--tb` option with
which `pytest` is configured: some of these representations do not
include the traceback frames to allow us to calculate line numbers.

`pytest_runtest_makereport`, however, has access to the original
`ExceptionInfo` object when an exception is raised: this commit switches
to using a `pytest_runtest_makereport` hookwrapper, so we can access the
pytest-generated report as before, but get exception handling
independent of `--tb` setting.

Fixes: #28
2022-11-08 09:23:58 +00:00
Jongwook Choi 276881193d feat(pytest): exception breakpoints when running with dap strategy (#25)
When running neotest with the DAP strategy (nvim-dap), e.g.

    require("neotest").run.run({ strategy = "dap" })

we make the pydebug debugger stop at "exception breakpoints"
where the exception is thrown out of a pytest method.

This will be very helpful for users to debug failing unit tests.
2022-11-02 09:36:05 +00:00
Rónán Carrigan ba7069a030 fix(pytest): don't reverse namespaces
See #26
2022-10-31 14:14:52 +00:00
Jongwook Choi 2dc9c95fe9 refactor(pytest): PytestNeotestAdapter (#24)
Having `NeotestResultCollector` (a pytest plugin) as a inner local
class would make the code a bit difficult to read due to quite much
indentation. This commit does refactoring on NeotestResultCollector
to make it a module-level class with a reference to NeotestAdapter.

This refactoring would make easier adding more pytest plugins
(e.g., debugger integration) in the future.

There should be no changes in behaviors.
2022-10-29 13:23:40 +01:00
Rónán Carrigan 9e2db9375c docs(README): link to debug config values
See https://github.com/nvim-neotest/neotest/issues/132
2022-10-27 09:06:00 +01:00
Rónán Carrigan 8aca335334 fix(pytest): use rootdir instead of rootpath
See #21
2022-10-20 08:03:18 +01:00
Rónán Carrigan 15f566a484 fix: check exit code of proc
See https://github.com/nvim-neotest/neotest/issues/127
2022-10-13 08:44:58 +01:00
Nick eb8fa2c48c fix: assing script path var (#18) 2022-10-03 08:44:16 +01:00
Rónán Carrigan 143aacd04e fix: search runtime for python script
See https://github.com/nvim-neotest/neotest/issues/118
2022-10-01 14:48:18 +01:00
Rónán Carrigan a0c5c567fb fix: use correct separator
See https://github.com/nvim-neotest/neotest/issues/118
2022-09-28 09:02:29 +01:00
Rónán Carrigan 288e58b83d feat: filter_dir function 2022-09-12 06:59:47 +01:00
Rónán Carrigan c76e25df65 feat: custom python command
See #14
2022-08-21 21:28:56 +01:00
Rónán Carrigan 20df51e06f feat: mark deselected tests as skipped
See #13
2022-08-03 22:29:45 +01:00
Rónán Carrigan b6c46fe3a0 docs: LICENCE 2022-07-25 21:23:34 +01:00
Rónán Carrigan aaf83100b6 feat: streamed results 2022-07-23 15:02:35 +01:00
Rónán Carrigan 023b7bda64 fix: handle missing pipenv/poetry
See #10
2022-07-10 17:19:57 +01:00
Rónán Carrigan 4d915fbefd fix(unittest): handle extra args 2022-07-02 09:58:14 +01:00
Rónán Carrigan 4ded85dfbf fix: default root to cwd in python detection 2022-06-26 10:48:41 +01:00
Nick fe5fbe4e34 feat: poetry/pipenv python detection (#9) 2022-06-23 09:36:05 +01:00
Rónán Carrigan de234d600e feat: custom test file detection
See #3
2022-06-14 10:16:58 +01:00
Rónán Carrigan e8ce1d3047 docs: README 2022-06-13 08:45:19 +01:00
Rónán Carrigan 16ed9f6079 fix(pytest): handle xfail exc repr
See #5
2022-06-09 21:15:17 +01:00
Rónán Carrigan e4a97894b5 fix: include extra args 2022-06-08 22:10:43 +01:00
Rónán Carrigan 304cee0223 fix: allow files ending in _test
See #3
2022-06-08 21:24:06 +01:00
Steven Arcangeli c09c4136bb fix(unittest): correct args for tests/classes/files (#2)
* fix: unittest adapter can run specific tests/groups/files

* fix: running tests at the directory level

* refactor: tidy id_to_unittest_args and remove print
2022-06-08 20:58:05 +01:00
Steven Arcangeli fd75c18c14 fix: record skipped and error test results (#1) 2022-06-08 08:00:53 +01:00
Rónán Carrigan e040840e65 feat: remove vim-test arg compat 2022-06-05 11:24:07 +01:00
Rónán Carrigan ff70ffac75 refactor: rename types 2022-03-13 15:16:23 +00:00