How do you specify the only test to run with pytest k parameter? The Next CEO of Stack OverflowHow do you split a list into evenly sized chunks?How do you change the size of figures drawn with matplotlib?How to return multiple values from a function?How do you read from stdin?Python progression path - From apprentice to guruHow do you append to a file in Python?How do I configure PyCharm to run py.test tests?pg_config executable not foundPyTest doesn't run any testUsual pytest workflow - can't run tests in a file

Is it ever safe to open a suspicious html file (e.g. email attachment)?

What does convergence in distribution "in the Gromov–Hausdorff" sense mean?

Complex fractions

MessageLevel in QGIS3

Inappropriate reference requests from Journal reviewers

Received an invoice from my ex-employer billing me for training; how to handle?

What is the result of assigning to std::vector<T>::begin()?

Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?

Are there any unintended negative consequences to allowing PCs to gain multiple levels at once in a short milestone-XP game?

How do I go from 300 unfinished/half written blog posts, to published posts?

What connection does MS Office have to Netscape Navigator?

If the heap is initialized for security, then why is the stack uninitialized?

What happened in Rome, when the western empire "fell"?

Preparing Indesign booklet with .psd graphics for print

Is there a way to save my career from absolute disaster?

multiple labels for a single equation

Why do professional authors make "consistency" mistakes? And how to avoid them?

Why has the US not been more assertive in confronting Russia in recent years?

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

What does "Its cash flow is deeply negative" mean?

How did people program for Consoles with multiple CPUs?

If/When UK leaves the EU, can a future goverment conduct a referendum to join the EU?

What exact does MIB represent in SNMP? How is it different from OID?

SQL Server 2016 - excessive memory grant warning on poor performing query



How do you specify the only test to run with pytest k parameter?



The Next CEO of Stack OverflowHow do you split a list into evenly sized chunks?How do you change the size of figures drawn with matplotlib?How to return multiple values from a function?How do you read from stdin?Python progression path - From apprentice to guruHow do you append to a file in Python?How do I configure PyCharm to run py.test tests?pg_config executable not foundPyTest doesn't run any testUsual pytest workflow - can't run tests in a file










0















I've tried the following:



python -m pytest ./subfolder -k 'test_common_fields'



This doesn't work at all. It finds nothing but this test exists in that subfolder's file of the same name 'subfolder/test_subfolder.py'



I tried entering full path: -k 'subfolder/test_subfolder.py::test_common_fields' and without "subfolder" path. Nothing.










share|improve this question






















  • python -m pytest ./subfolder/test_subfolder.py -k 'test_common_fields' does this work?

    – suicidalteddy
    Mar 7 at 15:25











  • no it turns out i didn't need single quotes.

    – Dexter
    Mar 7 at 17:39






  • 1





    @Dexter ah, you're on windows using cmd.exe?

    – Anthony Sottile
    Mar 9 at 17:12















0















I've tried the following:



python -m pytest ./subfolder -k 'test_common_fields'



This doesn't work at all. It finds nothing but this test exists in that subfolder's file of the same name 'subfolder/test_subfolder.py'



I tried entering full path: -k 'subfolder/test_subfolder.py::test_common_fields' and without "subfolder" path. Nothing.










share|improve this question






















  • python -m pytest ./subfolder/test_subfolder.py -k 'test_common_fields' does this work?

    – suicidalteddy
    Mar 7 at 15:25











  • no it turns out i didn't need single quotes.

    – Dexter
    Mar 7 at 17:39






  • 1





    @Dexter ah, you're on windows using cmd.exe?

    – Anthony Sottile
    Mar 9 at 17:12













0












0








0








I've tried the following:



python -m pytest ./subfolder -k 'test_common_fields'



This doesn't work at all. It finds nothing but this test exists in that subfolder's file of the same name 'subfolder/test_subfolder.py'



I tried entering full path: -k 'subfolder/test_subfolder.py::test_common_fields' and without "subfolder" path. Nothing.










share|improve this question














I've tried the following:



python -m pytest ./subfolder -k 'test_common_fields'



This doesn't work at all. It finds nothing but this test exists in that subfolder's file of the same name 'subfolder/test_subfolder.py'



I tried entering full path: -k 'subfolder/test_subfolder.py::test_common_fields' and without "subfolder" path. Nothing.







python pytest






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 15:17









DexterDexter

3,24586086




3,24586086












  • python -m pytest ./subfolder/test_subfolder.py -k 'test_common_fields' does this work?

    – suicidalteddy
    Mar 7 at 15:25











  • no it turns out i didn't need single quotes.

    – Dexter
    Mar 7 at 17:39






  • 1





    @Dexter ah, you're on windows using cmd.exe?

    – Anthony Sottile
    Mar 9 at 17:12

















  • python -m pytest ./subfolder/test_subfolder.py -k 'test_common_fields' does this work?

    – suicidalteddy
    Mar 7 at 15:25











  • no it turns out i didn't need single quotes.

    – Dexter
    Mar 7 at 17:39






  • 1





    @Dexter ah, you're on windows using cmd.exe?

    – Anthony Sottile
    Mar 9 at 17:12
















python -m pytest ./subfolder/test_subfolder.py -k 'test_common_fields' does this work?

– suicidalteddy
Mar 7 at 15:25





python -m pytest ./subfolder/test_subfolder.py -k 'test_common_fields' does this work?

– suicidalteddy
Mar 7 at 15:25













no it turns out i didn't need single quotes.

– Dexter
Mar 7 at 17:39





no it turns out i didn't need single quotes.

– Dexter
Mar 7 at 17:39




1




1





@Dexter ah, you're on windows using cmd.exe?

– Anthony Sottile
Mar 9 at 17:12





@Dexter ah, you're on windows using cmd.exe?

– Anthony Sottile
Mar 9 at 17:12












1 Answer
1






active

oldest

votes


















1














On Ubuntu, I generally use py.test --verbose -k testcase_1 test_xyz.py






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55047163%2fhow-do-you-specify-the-only-test-to-run-with-pytest-k-parameter%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    On Ubuntu, I generally use py.test --verbose -k testcase_1 test_xyz.py






    share|improve this answer



























      1














      On Ubuntu, I generally use py.test --verbose -k testcase_1 test_xyz.py






      share|improve this answer

























        1












        1








        1







        On Ubuntu, I generally use py.test --verbose -k testcase_1 test_xyz.py






        share|improve this answer













        On Ubuntu, I generally use py.test --verbose -k testcase_1 test_xyz.py







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 12 at 22:28









        Kiran VemuriKiran Vemuri

        7151934




        7151934





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55047163%2fhow-do-you-specify-the-only-test-to-run-with-pytest-k-parameter%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown