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

Elevate warnings to errors in the test suite #6094

Merged
merged 9 commits into from Apr 12, 2022

Conversation

graingert
Copy link
Member

@graingert graingert commented Apr 8, 2022

Copy link
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Thanks @graingert

@@ -194,7 +194,7 @@ def close(self, timeout=None):
return self.sync(self._close, callback_timeout=timeout)

def __del__(self):
if self.status != Status.closed:
if getattr(self, "status", Status.closed) != Status.closed:
Copy link
Member

Choose a reason for hiding this comment

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

When would a Cluster instance not have a status attribute?

Copy link
Member Author

Choose a reason for hiding this comment

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

attributes aren't guaranteed to exist in def __del__



@pytest.mark.avoid_ci
def test_old_ssh_with_local_dir(loop):
with pytest.warns(Warning):
Copy link
Member

Choose a reason for hiding this comment

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

It appears we're just dropping the pytest.warns ctx manager here. Was this test just failing before, but went unnoticed due to the pytest.mark.avoid_ci marker?

Copy link
Member Author

Choose a reason for hiding this comment

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

introduced here, it doesn't warn anymore (or at least when I run the test on my machine)!

https://github.com/dask/distributed/pull/3684/files#diff-4caf94ab5350553c0fe1f9f8d3fcd9537e4a11fb3f097a86e987b9cd46496656R67

@@ -264,12 +265,14 @@ async def test_assert_no_warning_no_overload(c, s, a):
class Dummy(WorkerPlugin):
pass

with pytest.warns(None):
with warnings.catch_warnings(record=True) as record:
Copy link
Member

Choose a reason for hiding this comment

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

Nice, thanks for cleaning this pytest deprecation up

Copy link
Member Author

Choose a reason for hiding this comment

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

technically with warnings.catch_warnings(record=True) as record: .... assert not record isn't needed with filterwarnings=error because warnings will throw errors and fail the test. But I left it in in case filterwarnings config is ever removed

for i in range(10):
future = c.submit(lambda x, y: x, data, i)

assert len(record) < 2
Copy link
Member

Choose a reason for hiding this comment

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

IIUC it looks like we're dropping this check

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've now restored this as assert not record

@github-actions
Copy link
Contributor

github-actions bot commented Apr 8, 2022

Unit Test Results

       16 files  ±0         16 suites  ±0   7h 2m 28s ⏱️ - 35m 53s
  2 730 tests ±0    2 650 ✔️ ±0       80 💤 ±0  0 ±0 
21 725 runs  ±0  20 652 ✔️ +2  1 073 💤  - 2  0 ±0 

Results for commit 8f11999. ± Comparison against base commit f6b2e03.

♻️ This comment has been updated with latest results.

@graingert graingert force-pushed the enable-pytest-strict branch 4 times, most recently from befe6e1 to d6e7f12 Compare April 11, 2022 12:48
@mrocklin
Copy link
Member

@jrbourbeau do you have time to continue reviewing this?

@graingert graingert marked this pull request as ready for review April 11, 2022 17:16
@jrbourbeau jrbourbeau changed the title configure filterwarnings=error Elevate warnings to errors in the test suite Apr 12, 2022
Copy link
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Thanks @graingert -- the changes here look good to me, thank you for working on this. As I mentioned offline, I'm curious to see how often new warnings pop up (now as test failures). But this certainly has value, so let's give it a try

Also, it's nice to see a fully green build ✅

@jrbourbeau jrbourbeau merged commit 3c3d4e1 into dask:main Apr 12, 2022
@graingert graingert deleted the enable-pytest-strict branch April 12, 2022 08:15
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

3 participants