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

py3: Automatically alias OSError subclasses in exception doctests #25676

Closed
embray opened this issue Jun 27, 2018 · 13 comments
Closed

py3: Automatically alias OSError subclasses in exception doctests #25676

embray opened this issue Jun 27, 2018 · 13 comments

Comments

@embray
Copy link
Contributor

embray commented Jun 27, 2018

There are at least a handful of doctests that expect OSError to be raised. However, Python 3 added many OSError subclasses that are raised in many common cases instead (e.g. FileNotFoundError).

This patches doctest results to paper over this difference in doctests written against Python 2.

CC: @slel @vinklein

Component: python3

Author: Erik Bray

Branch/Commit: 4fff9a0

Reviewer: Frédéric Chapoton, Vincent Klein

Issue created by migration from https://trac.sagemath.org/ticket/25676

@embray embray added this to the sage-8.3 milestone Jun 27, 2018
@slel slel changed the title py3: Automatically alias OSError subclases in exception doctests py3: Automatically alias OSError subclasses in exception doctests Jun 27, 2018
@fchapoton
Copy link
Contributor

comment:3

pyflakes plugin is not happy..

@embray
Copy link
Contributor Author

embray commented Jun 28, 2018

comment:4

Replying to @fchapoton:

pyflakes plugin is not happy..

Not due to anything related to these changes. If someone will otherwise give a conditional positive review to this ticket I'll make sure the pyflakes warnings get taken care of as a rider to this before it's merged.

@vinklein
Copy link
Mannequin

vinklein mannequin commented Jul 5, 2018

comment:6

Edit remove old comment as it matters only with twisted ways of building error messages.

@vinklein
Copy link
Mannequin

vinklein mannequin commented Jul 6, 2018

comment:7

Why two line break ?

                                    exc_msg = exc_msg.replace(subcls, 'OSError',

                                                              1)

@embray
Copy link
Contributor Author

embray commented Jul 6, 2018

comment:8

Huh?

@vinklein
Copy link
Mannequin

vinklein mannequin commented Jul 6, 2018

comment:9

i mean why writing :

exc_msg = exc_msg.replace(subcls, 'OSError',

                          1)

rather than

exc_msg = exc_msg.replace(subcls, 'OSError',
                          1)

I am not saying it's an important issue (it's not). I just wonder why.

@embray
Copy link
Contributor Author

embray commented Jul 9, 2018

comment:10

I don't know. My editor is configured to enforce a 79 character line and knows Python syntax (most of the time) so it will bump things onto the next line when it can.

@slel
Copy link
Member

slel commented Jul 9, 2018

comment:11

Name the subclass "sc" instead of "subcls"
in the for loop to get a shorter line?

@embray
Copy link
Contributor Author

embray commented Jul 10, 2018

comment:12

It's....really okay.

@fchapoton
Copy link
Contributor

comment:13

let it be

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton, Vincent Klein

@embray
Copy link
Contributor Author

embray commented Jul 18, 2018

comment:14

I believe this issue can reasonably be addressed for Sage 8.4.

@embray embray modified the milestones: sage-8.3, sage-8.4 Jul 18, 2018
@vbraun
Copy link
Member

vbraun commented Aug 5, 2018

Changed branch from u/embray/python3/doctest/oserror-subclasses to 4fff9a0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants