Skip to content

Don't crash with --pyargs and a filename that looks like a module #5503

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

Merged
merged 1 commit into from
Jun 27, 2019
Merged

Don't crash with --pyargs and a filename that looks like a module #5503

merged 1 commit into from
Jun 27, 2019

Conversation

asottile
Copy link
Member

No description provided.

def test_pyargs_filename_looks_like_module(self, testdir):
testdir.tmpdir.join("conftest.py").ensure()
testdir.tmpdir.join("t.py").write("def test(): pass")
result = testdir.runpytest("--pyargs", "t.py")
Copy link
Member

Choose a reason for hiding this comment

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

Hmm what happens here? Does it run the file? Is that what's expected?

Copy link
Member Author

Choose a reason for hiding this comment

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

it runs the file, yes -- it's at least consistent with the 4.6.x behaviour -- I didn't really consider whether this is sane / correct or not 😆

I've never really worked with --pyargs so I'm not sure what the expected thing is here

Copy link
Member

Choose a reason for hiding this comment

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

Well if it works like 4.6.x then that's fine by me!

Thanks for the quick fix!

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

Only missing a CHANGELOG entry. 👍

def test_pyargs_filename_looks_like_module(self, testdir):
testdir.tmpdir.join("conftest.py").ensure()
testdir.tmpdir.join("t.py").write("def test(): pass")
result = testdir.runpytest("--pyargs", "t.py")
Copy link
Member

Choose a reason for hiding this comment

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

Well if it works like 4.6.x then that's fine by me!

Thanks for the quick fix!

@nicoddemus
Copy link
Member

Only missing a CHANGELOG entry.

That is, unless that bug was never released in the first place.

@asottile
Copy link
Member Author

Only missing a CHANGELOG entry.

That is, unless that bug was never released in the first place.

:this:

@asottile
Copy link
Member Author

@nicoddemus approve? :D

@nicoddemus
Copy link
Member

Oh sorry!

@nicoddemus nicoddemus merged commit 65fbdf2 into pytest-dev:master Jun 27, 2019
@nicoddemus
Copy link
Member

Feel free to cut the 5.0.0 release; I won't have time until later today

@asottile asottile deleted the pyargs_python_file branch June 27, 2019 16:54
@asottile
Copy link
Member Author

Feel free to cut the 5.0.0 release; I won't have time until later today

sounds good! I'll take a stab at it and fix up the things in the original PR 👍

@nicoddemus
Copy link
Member

Awesome 🎉

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.

2 participants