Skip to content

Conversation

@gsalgado
Copy link

@gsalgado gsalgado commented Jul 11, 2018

That way we preserve the original traceback, and make debugging easier

Closes: https://bugs.python.org/issue34098

Note to self: use ./python -m unittest -v test.test_multiprocessing_fork.WithManagerTestMyManager to run the tests

https://bugs.python.org/issue34098

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

When your account is ready, please add a comment in this pull request
and a Python core developer will remove the CLA not signed label
to make the bot check again.

Thanks again for your contribution, we look forward to reviewing it!

@gsalgado
Copy link
Author

I've signed the CLA and it's been processed already. Can somebody remove the CLA not signed label?

@pablogsal
Copy link
Member

Hi @gsalgado and thank you for your contribution! Could you add a NEWS entry using the blurb tool as described here? Thanks!

@gsalgado
Copy link
Author

NEWS entry added, @pablogsal

@pablogsal
Copy link
Member

pablogsal commented Jul 16, 2018

@gsalgado Thanks! As a general note, please, do not squash/amend the commits as is easier to check individual changes than a big commit when reviewing. The Pull Request will be squashed when merged (squash and merge) so it does not matter that much to preserve commit hygiene in the PR itself (although it helps when reviewing).

@@ -0,0 +1,2 @@
Embed stringification of remote traceback in local traceback when a method
Copy link
Member

@pablogsal pablogsal Jul 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use method when formatting classes and such. For example:

Fix warning message when os.chdir() fails inside
test.support.temp_cwd(). Patch by Chris Jerdonek.

Also, add a colon at the end of the line. :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablogsal done. used double backticks like I've found in other NEWS entries

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add "Patch by Guilherme Salgado" at the end. :)

@gsalgado
Copy link
Author

I'd forgotten this was still open... Any chance somebody can review it?

@csabella csabella requested a review from pitrou March 25, 2019 22:51
Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Here are some comments about the proposed changes.

self.assertEqual(foo.f(), 'f()')
self.assertRaises(ValueError, foo.g)
with self.assertRaises(ValueError) as ctx:
foo._callmethod('g')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you simply call foo.g here? Is _callmethod doing something special?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember, really, but foo.g() seems to work as well, so I'll change it

with self.assertRaises(ValueError) as ctx:
foo._callmethod('g')
cause = ctx.exception.__cause__
self.assertIsInstance(cause, multiprocessing.pool.RemoteTraceback)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of testing low-level details, how about something pertaining to the user's experience?
For example you could have:

class FooBar(object):
    def f(self):
        return 'f()'
    def g(self):
        raise ValueError  # exception raised here
    def _h(self):
        return '_h()'

And then self.assertIn('# exception raised here', str(cause)).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, but should I drop the self.assertIsInstance(cause, multiprocessing.pool.RemoteTraceback) check, then?

@pitrou
Copy link
Member

pitrou commented Mar 26, 2019

Also, since this PR is a bit old, can you merge/rebase master into it?

@gsalgado
Copy link
Author

Also, since this PR is a bit old, can you merge/rebase master into it?

Done

Copy link
Contributor

@MaxwellDupre MaxwellDupre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example given:
Ran 3 tests in 0.360s
OK
Ran test_multi*
Ran 345 tests in 183.352s
OK (skipped=32)
Ran 39 tests in 21.005s
OK
Ran 345 tests in 79.499s
OK (skipped=33)
Ran 345 tests in 92.366s
OK (skipped=29)
Looks ok.

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review stale Stale PR or inactive for long period of time. topic-multiprocessing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants