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
merged 3 commits into from Sep 25, 2016

Conversation

Projects
None yet
4 participants
@davidszotten
Copy link
Contributor

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

This comment has been minimized.

Copy link

coveralls commented Sep 19, 2016

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

This comment has been minimized.

Copy link
Member

nicoddemus commented Sep 21, 2016

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

This comment has been minimized.

Copy link
Contributor Author

davidszotten commented Sep 21, 2016

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

This comment has been minimized.

Copy link
Contributor Author

davidszotten commented Sep 21, 2016

ok, think i got it working

@davidszotten

This comment has been minimized.

Copy link
Contributor Author

davidszotten commented Sep 21, 2016

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

@coveralls

This comment has been minimized.

Copy link

coveralls commented Sep 21, 2016

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor Author

davidszotten commented Sep 21, 2016

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

@davidszotten davidszotten changed the base branch from master to features Sep 21, 2016

@davidszotten davidszotten force-pushed the davidszotten:pdbcls_without_pdb_on_fail branch from 4732b26 to d75748e Sep 21, 2016

@coveralls

This comment has been minimized.

Copy link

coveralls commented Sep 21, 2016

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.

@nicoddemus nicoddemus merged commit 5e96edd into pytest-dev:features Sep 25, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

nicoddemus added a commit that referenced this pull request Sep 25, 2016

Mention #1952 on the CHANGELOG
Also created "New Features" and "Changes" sections.

This was referenced Mar 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.