Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pdbcls without pdb on fail #1952

Merged

Conversation

davidszotten
Copy link
Contributor

@davidszotten davidszotten commented Sep 19, 2016

fixes #1948

i tried to add a final test for using pdb.set_trace(), but couldn't get it to work. any advice appreciated

    def test_pdb_custom_cls_with_settrace(self, testdir, custom_pdb_calls):
        testdir.makepyfile(custom_pdb="""
            class CustomPdb:
                def __init__(self, *args, **kwargs):
                    called.append("init")

                def reset(self):
                    called.append("reset")

                def interaction(self, *args):
                    called.append("interaction")
         """)
        p1 = testdir.makepyfile("""
            import pytest

            def test_foo():
                pytest.set_trace()
        """)
        child = testdir.spawn_pytest("--pdbcls=custom_pdb:CustomPdb %s" % str(p1))
        child.expect("interaction")
        child.send('c\n')
        child.sendeof()
        if child.isalive():
            child.wait()
        assert custom_pdb_calls == ["init", "reset", "interaction"]

@coveralls
Copy link

Coverage Status

Coverage remained the same at 93.079% when pulling 3339921 on davidszotten:pdbcls_without_pdb_on_fail into 8639bf7 on pytest-dev:master.

@nicoddemus
Copy link
Member

The patch looks good to me, although it should go into features instead.

About your test, what is the error you are getting? Also, I don't see the connection between the custom_pdb_calls fixture and the CustomPdb class you define in the test(the custom_pdb module) which is accessing an undeclared module level variable named called.

@davidszotten
Copy link
Contributor Author

ah yes, the content of the CustomPdb is broken (leftover from the tests that use a similar class) but i don't think we get there INTERNALERROR> ImportError: No module named custom_pdb. unless i'm misunderstanding, i take that to mean that the pytest invocation spawn_pytest can't even find the custom module

@davidszotten
Copy link
Contributor Author

ok, think i got it working

@davidszotten
Copy link
Contributor Author

@nicoddemus is "it should go into features instead." something you need from me or just a reply to @RonnyPfannschmidt ?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.0008%) to 93.078% when pulling 4732b26 on davidszotten:pdbcls_without_pdb_on_fail into 8639bf7 on pytest-dev:master.

@flub
Copy link
Member

flub commented Sep 21, 2016

@davidszotten you need to click edit next to the PR title which will give you a drop down list where you can choose between master and features. After changing to features you'll probably have to fix merge-conflicts for the changelog file and then it should be good to go

@davidszotten
Copy link
Contributor Author

ah, "be raised against the features branch". apologies for not catching on.

@davidszotten davidszotten changed the base branch from master to features September 21, 2016 09:41
@davidszotten davidszotten force-pushed the pdbcls_without_pdb_on_fail branch from 4732b26 to d75748e Compare September 21, 2016 09:46
@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.938% when pulling d75748e on davidszotten:pdbcls_without_pdb_on_fail into 887c097 on pytest-dev:features.

This was referenced Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants