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

run accidentally-skipped tests #3597

Merged
merged 1 commit into from
Oct 30, 2020
Merged

run accidentally-skipped tests #3597

merged 1 commit into from
Oct 30, 2020

Conversation

jameslamb
Copy link

Summary

While working on #3596 , I saw that a handful of tests on DaskKubernetesEnvironment looked like they were accidentally missing an assert.

This PR fixes those and other tests in tests/, so that they'll fail when they should.

Changes

Added assert to a few comparisons in tests/ that looked like they were intended to be test cases that fail if False.

Importance

The changes in this PR ensure that tests that fail do so loudly, so that problematic changes to the code they cover don't accidentally get merged.

Checklist

This PR:

  • adds new tests (if appropriate)
  • adds a change file in the changes/ directory (if appropriate)
  • updates docstrings for any new functions or function arguments, including docs/outline.toml for API reference docs (if appropriate)

Notes for reviewers

After noticing this working on #3596 , I searched for other cases with pylint:

pylint tests/ | grep expression-not-assigned
pylint logs with duplicates removed (click me)
I searched for these with the following comand:

```shell
tests/environments/execution/test_dask_k8s_environment.py:344:4: W0106: Expression "yaml_obj['spec']['imagePullSecrets'][0] == dict(name='foo-man-docker')" is assigned to nothing (expression-not-assigned)
tests/environments/execution/test_dask_k8s_environment.py:363:4: W0106: Expression "yaml_obj['spec']['imagePullSecrets'][0] == dict(name='mysecret')" is assigned to nothing (expression-not-assigned)
tests/schedules/test_schedules.py:43:4: W0106: Expression "output == [dt.add(days=1), dt.add(days=2), dt.add(days=3)]" is assigned to nothing (expression-not-assigned)

Even if you don't want to take on all of pylint, I think it would be worth enabling just this check in prefect's continuous integration jobs. It catches the types of issues that are easy for human reviewers to miss, and which can allow bugs in prefect to slip through the review process.

I think it would be a good idea to start adding pylint to your CI, with PRs that add one or two important error codes at a time to .pylintrc, to catch issues like this. The style things pylint catches are a matter of taste and not that important, but I've found in my projects that it catches code-correctness things that flake8 doesn't (for example: #3041, #3307).

Thanks for your time and consideration.

@codecov
Copy link

codecov bot commented Oct 30, 2020

Codecov Report

Merging #3597 into master will not change coverage.
The diff coverage is n/a.

Copy link

@jcrist jcrist left a comment

Choose a reason for hiding this comment

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

Thanks @jameslamb. I'm slightly hesitant about adding another linting tool, but if you wanted to put up a PR with a basic setup I'd be happy to review it.

Anyway, this LGTM, merging.

@jcrist jcrist merged commit 73cd396 into PrefectHQ:master Oct 30, 2020
@jameslamb jameslamb deleted the fix/skipped-tests branch October 30, 2020 16:12
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