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

[#10331] Re-enable Azure DevOps Windows and macOS tests. #1719

Merged
merged 12 commits into from Apr 14, 2022

Conversation

adiroiban
Copy link
Member

@adiroiban adiroiban commented Apr 11, 2022

Scope and purpose

See if we can resurect Azure CI.

Remove py3.6 as it looks like it's no longer supported by Azure

Try to fix or skip the failing tests.

I tried to skip only on CI, so if a Twisted dev runs the test suite on mac or Windows, those tests will not be automatically skipped.

For the skipped tests, I have only left a comment without create separate tickets.
I don't have any hope that in the future someone will search the tickets hunting for tests that can be re-enabled.
Rather, someone found a bug, will see the existing test and then try to see if the test can be fixed as part of the current bugfix effort.

Reduce the size of Windows and MacOS CI matrix to reduce flaky reports.
At this point, we don't have active Twisted developers on mac and Windows.

Contributor Checklist:

  • The associated ticket in Trac is here: https://twistedmatrix.com/trac/ticket/10331
  • I ran tox -e lint to format my patch to meet the Twisted Coding Standard
  • I have created a newsfragment in src/twisted/newsfragments/ (see: News files)
  • The title of the PR starts with the associated Trac ticket number (without the # character).
  • [NA] I have updated the automated tests and checked that all checks for the PR are green.
  • I have submitted the associated Trac ticket for review by adding the word review to the keywords field in Trac, and putting a link to this PR in the comment; it shows up in https://twisted.reviews/ now.
  • The merge commit will use the below format
    The first line is automatically generated by GitHub based on PR ID and branch name.
    The other lines generated by GitHub should be replaced.
Merge pull request #123 from twisted/4356-branch-name-with-trac-id

Author: adiroiban
Reviewer: 
Fixes: ticket:10331

Re-enable Windows and MacOS CI tests.

Copy link
Member

@exarkun exarkun left a comment

Choose a reason for hiding this comment

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

Assuming the Azure jobs pass, this looks good to me.

def test_noWakerConstructionWarnings(self):
"""
No warnings are generated when constructing the waker.
Copy link
Member Author

Choose a reason for hiding this comment

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

this is a test failing on Windows.
it was failing as it checked there are no warnings.

But there were warnings that were accumulated by running other tests.

I re-wrote a bit the test while trying to understand what it does.

@@ -22,6 +23,29 @@
from twisted.internet.tcp import Port


class WarningCheckerTestCase(TestCase):
Copy link
Member Author

Choose a reason for hiding this comment

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

This was added trying to catch tests producing warnings, but not consuming the warnings.

I left this code here as maybe it can help with future debugging... and help localize tests with side-effects.

@adiroiban adiroiban requested review from exarkun and a team April 12, 2022 13:17
Copy link
Member

@exarkun exarkun left a comment

Choose a reason for hiding this comment

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

I don't think I understand the skipping strategy. I left some words inline about this but there are other instances I skipped over because I suppose the answer will be the same.

src/twisted/conch/test/test_filetransfer.py Show resolved Hide resolved
src/twisted/internet/test/test_posixbase.py Show resolved Hide resolved
self.assertEqual(len(warnings), 0, warnings)

# Explicitly close the sockets as a cleanup and make sure we
# don't get other warnings here.
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what "as a cleanup" means here. The word "cleanup" suggests "TestCase.addCleanup" but then the code just goes ahead and closes the socket immediately. So maybe just remove "as a cleanup"?

Or maybe it really should use TestCase.addCleanup but that should happen on line 333 so that it happens even if the assertion on line 335 fails.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to rephrase. thanks.

@@ -71,6 +71,28 @@ def onlyOnPOSIX(testMethod):
return testMethod


def onlyOnLinuxCI(testMethod):
"""
Only run this test on Linux and macOS local tests and Linux CI platforms.
Copy link
Member

Choose a reason for hiding this comment

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

Again I don't understand why there is a CI check here. Why isn't the logic to run on Linux and skip on macOS and Windows, regardless of whether it is a CI environment or not?

testMethod.skip = "Failing on Azure macOS CI."

if resource is None:
testMethod.skip = "Test only applies to POSIX platforms."
Copy link
Member

Choose a reason for hiding this comment

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

For actually doing the skips, it seems like skipIf(not platform.isLinux(), "reason") is the conventional idiom.

Copy link
Member Author

Choose a reason for hiding this comment

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

True. I have refactored it...and the CI check was an error.

Copy link
Member Author

@adiroiban adiroiban 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 review.
I tried to update the PR based on your feedback.

I haven't refactored WarningCheckerTestCase into a fixture due to the fact that it would mean re-implementing flushWarnings

I hope this is ready to land now.

self.assertEqual(len(warnings), 0, warnings)

# Explicitly close the sockets as a cleanup and make sure we
# don't get other warnings here.
Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to rephrase. thanks.

testMethod.skip = "Failing on Azure macOS CI."

if resource is None:
testMethod.skip = "Test only applies to POSIX platforms."
Copy link
Member Author

Choose a reason for hiding this comment

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

True. I have refactored it...and the CI check was an error.

src/twisted/internet/test/test_posixbase.py Show resolved Hide resolved
Copy link
Member

@exarkun exarkun left a comment

Choose a reason for hiding this comment

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

Thanks. Looks good to me. A few trivial comments inline to fix, but then please merge.

# https://twistedmatrix.com/trac/ticket/10332
# For now, try to start each test without previous warnings
# on Windows CI environment.
# We still want to see failures on local Windows development environment to make it easier to fix then,
Copy link
Member

Choose a reason for hiding this comment

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

Typo at the end - "then"

# https://twistedmatrix.com/trac/ticket/10332
# For now don't raise errors on Windows as the existing tests are dirty and we don't have the dev resources to fix this.
# If you care about Twisted on Windows, enable this check and hunt for the test that is generating the warnings.
# Note that even with this check disabled, you can still see flaky tests on Windows, as due due stray delayed calls
Copy link
Member

Choose a reason for hiding this comment

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

Typo - "as due due stray"

# We still want to run it on local development macOS environments to help developers discover and fix this issue.
@skipIf(
platform.isMacOSX() and os.environ.get("CI", "").lower() == "true",
"Skipped on macOS CI en.",
Copy link
Member

Choose a reason for hiding this comment

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

not sure about "en" - typo? maybe "env"?

@adiroiban adiroiban merged commit 2077cca into trunk Apr 14, 2022
@adiroiban adiroiban deleted the 10331-win-mac-ci-azure branch July 19, 2022 11:10
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.

None yet

2 participants