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

Change Click error test assertions to be agnostic to Click version #2135

Merged
merged 2 commits into from
Mar 10, 2020

Conversation

wagoodman
Copy link

@wagoodman wagoodman commented Mar 9, 2020

Fix click test assertion to account for click v7.1 error formatting change. Also fixes select mypy issues due to mypy rule updates.

@wagoodman wagoodman force-pushed the click-test-error-output branch from 69bef89 to cc773da Compare March 9, 2020 18:16
@codecov
Copy link

codecov bot commented Mar 9, 2020

Codecov Report

Merging #2135 into master will increase coverage by <.01%.
The diff coverage is 85.71%.

@@ -381,7 +381,7 @@ def query_flow_runs(self, tenant_id: str) -> list:
"state": {"_eq": "Running"},
"task_runs": {
"state_start_time": {
"_lte": str(now.subtract(seconds=3))
"_lte": str(now.subtract(seconds=3)) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

@wagoodman forgot to ask: why were the typing changes necessary? Is this related to the new version of pendulum?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, there were mypy failures:

src/prefect/schedules/clocks.py:260: error: Item "None" of "Optional[Timezone]" has no attribute "name"
src/prefect/client/client.py:435: error: Incompatible types in assignment (expression has type "str", variable has type "DateTime")
src/prefect/client/client.py:482: error: Incompatible types in assignment (expression has type "str", variable has type "DateTime")
src/prefect/engine/result_handlers/s3_result_handler.py:94: error: Call to untyped function "format" in typed context
src/prefect/engine/result_handlers/gcs_result_handler.py:80: error: Call to untyped function "format" in typed context
src/prefect/engine/result_handlers/azure_result_handler.py:102: error: Call to untyped function "format" in typed context
src/prefect/agent/agent.py:384: error: Call to untyped function "subtract" in typed context
src/prefect/agent/agent.py:404: error: Call to untyped function "subtract" in typed context
src/prefect/agent/kubernetes/agent.py:24: error: Call to untyped function "timestamp" in typed context

The latest pendulum changes seem to be causing it (I think it's related to python-pendulum/pendulum#320 but didn't dig deeper):

~/code/prefect click-test-error-output*
venv381 ❯ mypy --config setup.cfg src
src/prefect/agent/kubernetes/agent.py:24: error: Call to untyped function "timestamp" in typed context
Found 1 error in 1 file (checked 179 source files)

~/code/prefect click-test-error-output* 11s
venv381 ❯ pip uninstall pendulum
Found existing installation: pendulum 2.1.0
Uninstalling pendulum-2.1.0:
...
  Successfully uninstalled pendulum-2.1.0

~/code/prefect click-test-error-output*
venv381 ❯ pip install pendulum==2.0.5
Collecting pendulum==2.0.5
...
Successfully installed pendulum-2.0.5

~/code/prefect click-test-error-output* 14s
venv381 ❯ mypy --config setup.cfg src
Success: no issues found in 179 source files

@cicdw cicdw merged commit 66703e5 into master Mar 10, 2020
@cicdw cicdw deleted the click-test-error-output branch March 10, 2020 15:07
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