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

[ci] fix masked tests #2567

Merged
merged 4 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions server/tests/database/test_hasura.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,10 +831,10 @@ async def test_execute_respects_as_box(self):
result = await HasuraClient().execute("query { x }")
assert isinstance(result, Box)
assert result.data.x == 1
assert isinstance(result.data.y[0].a, Box)
assert isinstance(result.data.y[0], Box)
assert result.data.y[0].a == 1

async def test_execute_respects_as_box(self):
async def test_execute_respects_not_as_box(self):
result = await HasuraClient().execute("query { x }", as_box=False)
assert isinstance(result, dict) and not isinstance(result, Box)
assert result["data"]["x"] == 1
Expand Down
4 changes: 2 additions & 2 deletions tests/agent/test_fargate_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def test_fargate_agent_config_env_vars_lists_dicts(monkeypatch, runner_token):
assert botocore_config.call_args == {}


def test_deploy_flow_raises(monkeypatch, runner_token):
def test_deploy_flow_local_storage_raises(monkeypatch, runner_token):
boto3_client = MagicMock()

boto3_client.describe_task_definition.return_value = {}
Expand All @@ -566,7 +566,7 @@ def test_deploy_flow_raises(monkeypatch, runner_token):
assert not boto3_client.run_task.called


def test_deploy_flow_raises(monkeypatch, runner_token):
def test_deploy_flow_docker_storage_raises(monkeypatch, runner_token):
boto3_client = MagicMock()

boto3_client.describe_task_definition.return_value = {}
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_list_tenants(patch_post):
assert "name" in result.output


def test_switch_tenants(monkeypatch):
def test_switch_tenants_success(monkeypatch):
with set_temporary_config({"cloud.graphql": "http://my-cloud.foo"}):
monkeypatch.setattr("prefect.cli.auth.Client", MagicMock())

Expand All @@ -130,7 +130,7 @@ def test_switch_tenants(monkeypatch):
assert "Tenant switched" in result.output


def test_switch_tenants(monkeypatch):
def test_switch_tenants_failed(monkeypatch):
with set_temporary_config({"cloud.graphql": "http://my-cloud.foo"}):
client = MagicMock()
client.return_value.login_to_tenant = MagicMock(return_value=False)
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_execute_help():
assert "Execute flow environments." in result.output


def test_execute_cloud_flow_fails():
def test_execute_cloud_flow_fails_outside_cloud_context():
runner = CliRunner()
result = runner.invoke(execute, "cloud-flow")
assert result.exit_code == 1
Expand Down
11 changes: 0 additions & 11 deletions tests/client/test_client_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,6 @@ def test_save_local_settings(self):
with path.open("r") as f:
assert toml.load(f)["api_token"] == "b"

def test_load_local_api_token_is_called_when_the_client_is_initialized_without_token(
self, cloud_api
):
with tempfile.TemporaryDirectory() as tmp:
with set_temporary_config({"home_dir": tmp}):
client = Client(api_token="a")
client.save_api_token()

client = Client()
assert client._api_token == "a"

def test_load_local_api_token_is_called_when_the_client_is_initialized_without_token(
self, cloud_api
):
Expand Down
4 changes: 3 additions & 1 deletion tests/core/test_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1903,7 +1903,9 @@ def store_y(y):

assert storage == dict(y=[[1, 1, 1], [1, 1, 1], [3, 3, 3]])

def test_flow_dot_run_handles_cached_states_across_runs(self, repeat_schedule):
def test_flow_dot_run_handles_cached_states_across_runs_with_always_run_trigger(
self, repeat_schedule
):
schedule = repeat_schedule(3)

class StatefulTask(Task):
Expand Down
27 changes: 0 additions & 27 deletions tests/engine/test_flow_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,33 +1173,6 @@ def test_parameters_overwrite_context():
assert state.result[x].result == 2


def test_parameters_overwrite_context_only_if_key_matches():
x = prefect.Parameter("x")
y = prefect.Parameter("y")
f = FlowRunner(Flow(name="test", tasks=[x, y]))
state = f.run(
parameters={"x": 2},
context={"parameters": {"x": 5, "y": 6}},
return_tasks=[x, y],
)


def test_parameters_can_be_set_in_context_if_none_passed():
x = prefect.Parameter("x")
f = FlowRunner(Flow(name="test", tasks=[x]))
state = f.run(parameters={}, context={"parameters": {"x": 5}}, return_tasks=[x])
assert state.result[x].result == 5


def test_parameters_overwrite_context():
x = prefect.Parameter("x")
f = FlowRunner(Flow(name="test", tasks=[x]))
state = f.run(
parameters={"x": 2}, context={"parameters": {"x": 5}}, return_tasks=[x]
)
assert state.result[x].result == 2


def test_parameters_overwrite_context_only_if_key_matches():
x = prefect.Parameter("x")
y = prefect.Parameter("y")
Expand Down
4 changes: 2 additions & 2 deletions tests/tasks/azureml/test_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ def test_initialization(self):

assert task.relative_root == relative_root

def test_missing_datastore_raises_error(self):
def test_missing_datastore_path_raises_error(self):
path = ""
task = DatastoreUpload(path=path)

with pytest.raises(ValueError, match="A datastore must be provided."):
task.run()

def test_missing_datastore_raises_error(self):
def test_missing_datastore_datastore_raises_error(self):
datastore = MagicMock()
task = DatastoreUpload(datastore=datastore)

Expand Down
2 changes: 1 addition & 1 deletion tests/tasks/dropbox/test_dropbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_creds_are_pulled_from_secret_at_runtime(self, monkeypatch):

assert dbx.call_args[0][0] == "HI"

def test_creds_are_pulled_from_secret_at_runtime(self, monkeypatch):
def test_non_dropbox_creds_are_pulled_from_secret_at_runtime(self, monkeypatch):
task = DropboxDownload(path="test", access_token_secret="DROPBOX_ACCESS_TOKEN")

dbx = MagicMock()
Expand Down