question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add 'how to run a specific test' to the docs

See original GitHub issue

Supposedly this runs a specific test:

import ipytest
ipytest.autoconfig()

def test1():
    assert 2*2 == 5
    
ipytest.config(defopts=False)
ipytest.run('{MODULE}::test1')

(btw, is there any way to pass defopts to run directly?)

and this runs a subset of tests with a certain substring in the name:

import ipytest
ipytest.autoconfig()

def test_this1():
    assert 2*2 == 11

def test_this2():
    assert 2*2 == 12
    
def test_that1():
    assert 2*2 == 21
    
def test_that2():
    assert 2*2 == 22    
    
ipytest.run('-k', 'this')

It was not obvious to figure it out 😃

I would suggest adding it to the docs.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
chmpcommented, Jul 13, 2022

Damn. Every time I think, but surely now I have seen all there is to see for IPython, there so something new. I was completely unware, that there are these hooks (for future ref: the docs). Thanks for making me aware. That would indeed be an option.

1reaction
chmpcommented, Jul 8, 2022

Hey @axil,

Thanks for these suggestions. You’re right the pytest command line arguments are definitely not obvious. Maybe something for a “tips and tricks” section with pointer into the pytest docs (my favs are “-x --pdb” or “–ff”).

Re giving the options directly: at the moment it is not possible, but I like it. Maybe having some way to specify them also via the magics would be cool. This way there is feature parity between the two ways of using ipytest.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I run a single test using Jest? - Stack Overflow
Another way is to run tests in watch mode, jest --watch , and then press P to filter the tests by typing the...
Read more >
Writing and Running Tests - Dune documentation
If you would only like to run a single test for your project, you may use dune exec to run the test executable...
Read more >
Maven Surefire Plugin – Running a Single Test
During development, you may run a single test class repeatedly. To run this through Maven, set the test property to a specific test...
Read more >
Run tests | IntelliJ IDEA Documentation - JetBrains
To run all tests in a folder, select this folder in the Project tool window and press Ctrl+Shift+F10 or select Run Tests in...
Read more >
Run Tests | Basic Guides | Guides | Docs - TestCafe
There are two ways to launch TestCafe tests. The simplest option is to use the testcafe shell command. Alternatively, you can launch tests...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found