Skip to content

Conversation

EvanKepner
Copy link
Contributor

Hi - this is a small addition to allow the --junit-xml arg to accept a string path as well as a file.

Example:

$ mypy file1.py --junit-xml=a.xml

$ mypy file1.py --junit.xml "this/is/a/test.xml"
$ tree this/
this/
└── is
    └── a
        └── test.xml

2 directories, 1 file

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

Calling makedirs makes some sense, but user expansion doesn’t.

@EvanKepner
Copy link
Contributor Author

Thanks for the review - I included the user expansion to catch cases of ~ in the path e.g. both ~/outputs/file.xml and $HOME/outputs/file.xml are valid path entries where the first is caught by the user expansion, and the latter is caught by the variable expansion. If you'd still like the removal of user expansion let me know and I'll commit the change. If user expansion is removed, then the --junit-xml=~/outputs/file.xml is created in the cwd as /your/cwd/~/outputs/file.xml.

@gvanrossum
Copy link
Member

You can write --junit-xml ~/outputs/file.xml, so there is no need to expand ~/. Please commit the change.

@EvanKepner
Copy link
Contributor Author

Thanks for the guidance - in my testing I was passing in the argument as a string with quotes which was my error, when I pass in the argument without the string quotes it operates as expected without the expand-user. Commit made, appreciate the review!

@msullivan
Copy link
Collaborator

I think we probably don't want expandvars either. Shells will do this for us, and we don't do it for any other filenames.

@gvanrossum
Copy link
Member

I think we probably don't want expandvars either. Shells will do this for us, and we don't do it for any other filenames.

Indeed, that's what I meant, sorry.

@EvanKepner
Copy link
Contributor Author

No problem at all, changes made.

@gvanrossum gvanrossum merged commit 94c54aa into python:master Oct 26, 2018
@gvanrossum
Copy link
Member

Thanks!

@EvanKepner
Copy link
Contributor Author

Absolutely, thanks for the feedback and accepting!

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.

3 participants