6 ms·
Pytest for Neovim
- deleted 1y ago[deleted]
- meitham 1y agoVery nice! Congrats on your release!
- richardhapb 1y agoThanks!!
- eterps 1y agoNice. Might be good to add to the README what you intend to improve on: https://github.com/nvim-neotest/neotest?tab=readme-ov-file https://github.com/nvim-neotest/neotest?tab=readme-ov-file
- richardhapb 1y agoYeah! I will. Thanks!
- ohduran 1y agoThis is so helpful, congrats!
- richardhapb 1y agoThanks!
- nickjj 1y agoWhat happens if your test produces a bunch of stdout, such as using `print(...)` somewhere? Where would it be displayed? A couple of questions about Docker based on the README: > enabled = true, -- Enable docker support What does this do in the end? Is it starting containers or adjusting which test command gets run by prefixing a Docker command? If so is there a way to opt out of that to have it still use Docker commands without it managing container lifecycles? > docker_path = '/usr/src/app', -- This is the default path, if you use docker compose this is obtained from the docker compose file How is this being read from that file? Are you reading a volume? Is this meant to be what the WORKDIR is set to? > docker_path_prefix = 'app', -- This is the prefix for the path in the cwd in your local, for example: root/app/<docker_app_content> Is this meant to be what the WORKDIR is set to or what the COMPOSE_PROJECT would be set to? > container = 'app-1', -- Container where the tests will be run Will this be ignored in favor of the compose service name if compose is set to true? > docker_compose_file = 'docker-compose.yml', -- This is the default docker compose file name The default name has been compose.yaml for a long time now btw, you may want to support both out of the box. > enable_docker_compose = true, -- Enable docker compose support What does this do vs not having it enabled?
- richardhapb 1y agoThanks for the feedback! I’ll update the README to clarify these points. You can view the full Pytest output using the :PytestOutput command. This shows all outputs from failing tests (since Pytest doesn’t display output for passing tests by default). I also plan to implement support for custom arguments — for example, Pytest's -s flag to show stdout even when tests pass. If Docker is disabled, all Docker-related features are also disabled. When Docker Compose is enabled, its configuration takes precedence over the plugin’s direct settings. The prefix_app setting maps your local directory to the Docker path. For example, if your current working directory is ~/projects/, and the prefix is app, the Docker path /usr/src/app will map to ~/projects/app. Docker is responsible only for path mapping and executing the Pytest command inside a running container — the container must already be running. If you're using Docker Compose, the plugin retrieves the Docker path from the volume configuration. For example, if your docker-compose.yml contains: volumes: - app:/usr/src/app Then /usr/src/app will be used as the Docker path. If enable_docker_compose is set to false, the plugin will fall back to the manually configured path instead. (Note: the container itself is not retrieved from Docker Compose at this point.)
- semiinfinitely 1y agoneovim is dead to me and yet I still spend ~hours a week configuring my editor to behave the way I want. whats wrong with me send help
- andrewl 1y agoI get the problem with spending too much time configuring things like Vim or Tmux. But I'm just getting started with NeoVim today to see if I want to go with it full time and get off of Vim. Why is NeoVim dead to you?
- yimby2001 1y ago[dead]
- freedomben 1y agoI switched from Vim to NeoVim about a year ago and have been quite pleased. Other than having to `alias vim='nvim'` due to unconquerable muscle memory, I haven't really noticed any change other than having a lot more plugin options
- semiinfinitely 1y agowasted too many hours of my life trying to configure basic things, then after all that time it still just segfaults lmao
- richardhapb 1y agoIt's a Neovim issue haha, but is fun and powerful do it!
- Jackevansevo 1y agoFor the longest time I've been using vims built-in `compiler` feature with tartansandal/vim-compiler-pytest combined tpope/vim-dispatch
- ryan-duve 1y agoCould you share an example of a workflow using the built in feature to run tests in Vim?
- Jackevansevo 1y agoSure, here's a recorded example: https://www.youtube.com/watch?v=TUeousvp4PQ https://www.youtube.com/watch?v=TUeousvp4PQ
- richardhapb 1y agoInteresting approach! Can you share more about this?
- Jackevansevo 1y agoRather than write something up or linking to a bunch of articles I recorded a quick screen capture: https://www.youtube.com/watch?v=TUeousvp4PQ https://www.youtube.com/watch?v=TUeousvp4PQ
- nickandbro 1y agoVery cool integration of neovim with pytest! I also am using neovim with python integration for my hobby project, vimgolf.ai , where I try to teach vim motions to those who haven't used vim. Only two levels so far, but hoping to increase that count in the near future.
- richardhapb 1y agoThanks! Really cool idea! I'm happy to help if you need — just share the link whenever you're ready!