Skip to content

[2.7] bpo-30283: Backport test_regrtest from master to 2.7#1513

Merged
vstinner merged 3 commits into
python:2.7from
vstinner:test_regrtest_27
May 9, 2017
Merged

[2.7] bpo-30283: Backport test_regrtest from master to 2.7#1513
vstinner merged 3 commits into
python:2.7from
vstinner:test_regrtest_27

Conversation

@vstinner

@vstinner vstinner commented May 9, 2017

Copy link
Copy Markdown
Member

No description provided.

@vstinner

vstinner commented May 9, 2017

Copy link
Copy Markdown
Member Author

Ah, as expected the test failed on Windows. I made a first serie of changes to be able to the error messages :-)

vstinner added 2 commits May 9, 2017 13:45
Function used by test_regrtest to simulate an interrupted unit test.
@vstinner vstinner merged commit d2aff60 into python:2.7 May 9, 2017
@vstinner vstinner deleted the test_regrtest_27 branch May 9, 2017 11:57
Comment thread Lib/test/regrtest.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

testdir is not passed to runtest() in 3.5.

Do you want to port this to 3.5?

Comment thread Lib/test/regrtest.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

testdir is not passed to a subprocess in 3.x.

Do you want to port this to 3.5-3.7?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh. I expected that only 2.7 has an old regrtest, but 3.5 also has the "old" regrtest. This change is required by test_regrtest for tests using -jN. It seems like we don't have these tests in 3.5 yet: test_regrtest only has unit tests on the command line parsing. Said differently, Python 3.5 is also impacted by bpo-30283. I added a comment in the issue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But master don't pass testdir too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But master don't pass testdir too.

In master, there is no need to pass testdir since regrtest is designed differently. run_test_in_subprocess() pass "ns" a dict which contains testdir. In the slave, setup_tests() is called with ns and so sys.path is updated properly.

I hate regrtest.py of Python 2.7/3.5, I would prefer to just replace it with master libregrtest...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, it is passed in slaveargs!

Comment thread Lib/test/regrtest.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

testdir is not passed to runtest() in 3.5.

Comment thread Lib/test/test_regrtest.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

'returncode stdout, stderr' looks strange.

This namedtuple is used only in two places, and only its stdout attribute is used. Wouldn't be simpler to return just stdout from run_command()? Or at least return a 3-tuple?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I prefer to mimick the API of the master branch to ease backports of more tests later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In any case using different delimiters looks strange.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh wow, I didn't notice that I did two mitakes: typo in the type name, and "," typo in the string describing fields. I'm surprised because "," seems to be simply ignored!? Fixed in PR 1516.

>>> collections.namedtuple('Point', 'x,y z')._fields
('x', 'y', 'z')

It seems like namedtuple tries to be kind and fix my mistakes :-)

Comment thread Lib/test/test_regrtest.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you want to port this test to 3.5?

Comment thread Lib/test/test_regrtest.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

PermissionError doesn't exist in 2.7.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh, nice catch. Too bad that we don't have basic flake8 tests on Python...

Comment thread Lib/test/test_regrtest.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not list comprehension?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The code comes from master, I don't remember why I used that syntax. Please modify directly the code in the master branch if you don't like it :-)

Comment thread Lib/test/test_regrtest.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wouldn't be better to compare sorted lists? This would check that tests are not duplicated.

In 3.x you can use assertCountEqual.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Again, the code is copied from the master branch. Any enhancement is welcome, but should be made first in the master branch ;-) I like your idea of comparison of sorted lists. I don't know assertCountEqual().

Comment thread Lib/test/test_regrtest.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why executed and tests are added in the third argument?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

When a test failed, I didn't see executed and tests values. Maybe I just missed them in the output, but it was quicker to use this tuple to fix my bug.

Comment thread Lib/test/test_regrtest.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it worth to add '-3'?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Since "make buildbottest" uses it: ok, I will add it in my following change.

@serhiy-storchaka

Copy link
Copy Markdown
Member

Oh, you again merged while I made a review.

@serhiy-storchaka

Copy link
Copy Markdown
Member

And again just 2 minutes before I finished it. 😄

@vstinner

vstinner commented May 9, 2017

Copy link
Copy Markdown
Member Author

Oh, you again merged while I made a review.

Did you loose your review? You can still review the change, no?

@serhiy-storchaka

Copy link
Copy Markdown
Member

No, my review isn't lost. You can read it.

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