Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Fix for pytest-asyncio bug (#1260)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Sanders <[email protected]>
  • Loading branch information
Paul Sanders and Paul Sanders authored Sep 6, 2022
1 parent 2e17978 commit 9331949
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The types of changes are:
* Fix issue with fideslog event loop errors [#1174](https://github.com/ethyca/fidesops/pull/1174)
* Allow passwords to be sent either base64 encode or as plaintext. [#1236](https://github.com/ethyca/fidesops/pull/1236)
* Allow worker to start up successfully for dev and dev_with_worker nox commands [#1250](https://github.com/ethyca/fidesops/pull/1250)
* Fix for pytest-asyncio bug [#1260](https://github.com/ethyca/fidesops/pull/1260)

## [1.7.2](https://github.com/ethyca/fidesops/compare/1.7.1...1.7.2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

@pytest.mark.integration_saas
@pytest.mark.integration_saas_override
@pytest.mark.asyncio
async def test_mailchimp_override_access_request_task(
db,
policy,
Expand Down Expand Up @@ -140,6 +141,7 @@ async def test_mailchimp_override_access_request_task(

@pytest.mark.integration_saas
@pytest.mark.integration_saas_override
@pytest.mark.asyncio
async def test_mailchimp_erasure_request_task(
db,
policy,
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/integration_tests/saas/test_adobe_campaign_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_adobe_campaign_connection_test(adobe_campaign_connection_config) -> Non
@pytest.mark.skip(reason="Only staging credentials available")
@pytest.mark.integration_saas
@pytest.mark.integration_adobe_campaign
@pytest.mark.asyncio
async def test_adobe_campaign_access_request_task(
policy,
adobe_campaign_identity_email,
Expand Down Expand Up @@ -160,6 +161,7 @@ async def test_adobe_campaign_access_request_task(
@pytest.mark.skip(reason="Only staging credentials available")
@pytest.mark.integration_saas
@pytest.mark.integration_adobe_campaign
@pytest.mark.asyncio
async def test_adobe_campaign_saas_erasure_request_task(
db,
policy,
Expand Down
1 change: 1 addition & 0 deletions tests/ops/integration_tests/saas/test_datadog_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_datadog_connection_test(datadog_connection_config) -> None:

@pytest.mark.integration_saas
@pytest.mark.integration_datadog
@pytest.mark.asyncio
async def test_saas_access_request_task(
db,
policy,
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/integration_tests/saas/test_hubspot_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test_hubspot_connection_test(connection_config_hubspot) -> None:

@pytest.mark.integration_saas
@pytest.mark.integration_hubspot
@pytest.mark.asyncio
async def test_saas_access_request_task(
db,
policy,
Expand Down Expand Up @@ -128,6 +129,7 @@ async def test_saas_access_request_task(

@pytest.mark.integration_saas
@pytest.mark.integration_hubspot
@pytest.mark.asyncio
async def test_saas_erasure_request_task(
db,
policy,
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/integration_tests/saas/test_mailchimp_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

@pytest.mark.integration_saas
@pytest.mark.integration_mailchimp
@pytest.mark.asyncio
async def test_mailchimp_access_request_task(
db,
policy,
Expand Down Expand Up @@ -123,6 +124,7 @@ async def test_mailchimp_access_request_task(

@pytest.mark.integration_saas
@pytest.mark.integration_mailchimp
@pytest.mark.asyncio
async def test_mailchimp_erasure_request_task(
db,
policy,
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/integration_tests/saas/test_outreach_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@pytest.mark.skip(reason="Currently unable to test OAuth2 connectors")
@pytest.mark.integration_saas
@pytest.mark.integration_outreach
@pytest.mark.asyncio
async def test_outreach_access_request_task(
db,
policy,
Expand Down Expand Up @@ -88,6 +89,7 @@ async def test_outreach_access_request_task(
@pytest.mark.skip(reason="Currently unable to test OAuth2 connectors")
@pytest.mark.integration_saas
@pytest.mark.integration_outreach
@pytest.mark.asyncio
async def test_outreach_erasure_request_task(
db,
policy,
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/integration_tests/saas/test_salesforce_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test_salesforce_connection_test(salesforce_connection_config) -> None:
@pytest.mark.skip(reason="Currently unable to test OAuth2 connectors")
@pytest.mark.integration_saas
@pytest.mark.integration_salesforce
@pytest.mark.asyncio
async def test_salesforce_access_request_task(
policy,
salesforce_identity_email,
Expand Down Expand Up @@ -371,6 +372,7 @@ async def test_salesforce_access_request_task(
@pytest.mark.skip(reason="Currently unable to test OAuth2 connectors")
@pytest.mark.integration_saas
@pytest.mark.integration_salesforce
@pytest.mark.asyncio
async def test_salesforce_erasure_request_task(
db,
policy,
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/integration_tests/saas/test_segment_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@pytest.mark.skip(reason="Pending account resolution")
@pytest.mark.integration_saas
@pytest.mark.integration_segment
@pytest.mark.asyncio
async def test_segment_saas_access_request_task(
db,
policy,
Expand Down Expand Up @@ -140,6 +141,7 @@ async def test_segment_saas_access_request_task(
@pytest.mark.skip(reason="Pending account resolution")
@pytest.mark.integration_saas
@pytest.mark.integration_segment
@pytest.mark.asyncio
async def test_segment_saas_erasure_request_task(
db,
policy,
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/integration_tests/saas/test_sendgrid_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

@pytest.mark.integration_saas
@pytest.mark.integration_sendgrid
@pytest.mark.asyncio
async def test_sendgrid_access_request_task(
db,
policy,
Expand Down Expand Up @@ -69,6 +70,7 @@ async def test_sendgrid_access_request_task(

@pytest.mark.integration_saas
@pytest.mark.integration_sendgrid
@pytest.mark.asyncio
async def test_sendgrid_erasure_request_task(
db,
policy,
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/integration_tests/saas/test_sentry_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@pytest.mark.skip(reason="Pending account resolution")
@pytest.mark.integration_saas
@pytest.mark.integration_sentry
@pytest.mark.asyncio
async def test_sentry_access_request_task(
db,
policy,
Expand Down Expand Up @@ -265,6 +266,7 @@ def sentry_erasure_test_prep(sentry_connection_config, db):
@pytest.mark.skip(reason="Pending account resolution")
@pytest.mark.integration_saas
@pytest.mark.integration_sentry
@pytest.mark.asyncio
async def test_sentry_erasure_request_task(
db, policy, sentry_connection_config, sentry_dataset_config
) -> None:
Expand Down
5 changes: 3 additions & 2 deletions tests/ops/integration_tests/saas/test_shopify_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def test_shopify_connection_test(shopify_connection_config) -> None:

@pytest.mark.integration_saas
@pytest.mark.integration_shopify
def test_shopify_access_request_task(
@pytest.mark.asyncio
async def test_shopify_access_request_task(
db,
policy,
shopify_connection_config,
Expand All @@ -37,7 +38,7 @@ def test_shopify_access_request_task(
merged_graph = shopify_dataset_config.get_graph()
graph = DatasetGraph(merged_graph)

v = graph_task.run_access_request(
v = await graph_task.run_access_request(
privacy_request,
policy,
graph,
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/integration_tests/saas/test_stripe_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

@pytest.mark.integration_saas
@pytest.mark.integration_stripe
@pytest.mark.asyncio
async def test_stripe_access_request_task(
db,
policy,
Expand Down Expand Up @@ -634,6 +635,7 @@ async def test_stripe_access_request_task(

@pytest.mark.integration_saas
@pytest.mark.integration_stripe
@pytest.mark.asyncio
async def test_stripe_erasure_request_task(
db,
policy,
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/integration_tests/saas/test_zendesk_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

@pytest.mark.integration_saas
@pytest.mark.integration_zendesk
@pytest.mark.asyncio
async def test_zendesk_access_request_task(
db,
policy,
Expand Down Expand Up @@ -178,6 +179,7 @@ async def test_zendesk_access_request_task(

@pytest.mark.integration_saas
@pytest.mark.integration_zendesk
@pytest.mark.asyncio
async def test_zendesk_erasure_request_task(
db,
policy,
Expand Down
7 changes: 7 additions & 0 deletions tests/ops/integration_tests/test_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def test_delete_collection_before_new_request(
assert pr.get_results() == {}

@mock.patch("fidesops.ops.task.graph_task.GraphTask.log_start")
@pytest.mark.asyncio
async def test_delete_collection_while_in_progress(
self,
mocked_log_start,
Expand Down Expand Up @@ -183,6 +184,7 @@ def delete_connection_config(_):

db.delete(mongo_connection_config)

@pytest.mark.asyncio
async def test_collection_omitted_on_restart_from_failure(
self,
db,
Expand Down Expand Up @@ -314,6 +316,7 @@ def test_delete_connection_config_on_completed_request(

@pytest.mark.integration
class TestSkipDisabledCollection:
@pytest.mark.asyncio
async def test_skip_collection_new_request(
self,
db,
Expand Down Expand Up @@ -359,6 +362,7 @@ async def test_skip_collection_new_request(
assert mongo_logs.filter_by(status="skipped").count() == 9

@mock.patch("fidesops.ops.task.graph_task.GraphTask.log_start")
@pytest.mark.asyncio
async def test_run_disabled_collections_in_progress(
self,
mocked_log_start,
Expand Down Expand Up @@ -449,6 +453,7 @@ def disable_connection_config(_):

db.delete(mongo_connection_config)

@pytest.mark.asyncio
async def test_skip_collection_on_restart(
self,
db,
Expand Down Expand Up @@ -581,6 +586,7 @@ def test_disable_connection_config_on_completed_request(


@pytest.mark.integration
@pytest.mark.asyncio
async def test_restart_graph_from_failure(
db,
policy,
Expand Down Expand Up @@ -717,6 +723,7 @@ async def test_restart_graph_from_failure(


@pytest.mark.integration
@pytest.mark.asyncio
async def test_restart_graph_from_failure_during_erasure(
db,
policy,
Expand Down
1 change: 1 addition & 0 deletions tests/ops/integration_tests/test_integration_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@pytest.mark.integration_postgres
@pytest.mark.integration
@pytest.mark.asyncio
async def test_collections_with_manual_erasure_confirmation(
db,
erasure_policy,
Expand Down
3 changes: 3 additions & 0 deletions tests/ops/integration_tests/test_manual_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
@pytest.mark.integration_postgres
@pytest.mark.integration
@pytest.mark.usefixtures("postgres_integration_db")
@pytest.mark.asyncio
async def test_postgres_with_manual_input_access_request_task(
db,
policy,
Expand Down Expand Up @@ -218,6 +219,7 @@ async def test_postgres_with_manual_input_access_request_task(
@pytest.mark.integration_postgres
@pytest.mark.integration
@pytest.mark.usefixtures("postgres_integration_db")
@pytest.mark.asyncio
async def test_no_manual_input_found(
policy,
db,
Expand Down Expand Up @@ -311,6 +313,7 @@ async def test_no_manual_input_found(

@pytest.mark.integration_postgres
@pytest.mark.integration
@pytest.mark.asyncio
async def test_collections_with_manual_erasure_confirmation(
db,
erasure_policy,
Expand Down
10 changes: 10 additions & 0 deletions tests/ops/integration_tests/test_mongo_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@


@pytest.mark.integration
@pytest.mark.asyncio
async def test_combined_erasure_task(
db,
mongo_inserts,
Expand Down Expand Up @@ -251,6 +252,7 @@ async def test_combined_erasure_task(

@pytest.mark.integration_mongodb
@pytest.mark.integration
@pytest.mark.asyncio
async def test_mongo_erasure_task(db, mongo_inserts, integration_mongodb_config):
policy = erasure_policy("A", "B")
seed_email = mongo_inserts["customer"][0]["email"]
Expand Down Expand Up @@ -293,6 +295,7 @@ async def test_mongo_erasure_task(db, mongo_inserts, integration_mongodb_config)

@pytest.mark.integration_mongodb
@pytest.mark.integration
@pytest.mark.asyncio
async def test_dask_mongo_task(
db, integration_mongodb_config: ConnectionConfig
) -> None:
Expand Down Expand Up @@ -329,6 +332,7 @@ async def test_dask_mongo_task(

@pytest.mark.integration_mongodb
@pytest.mark.integration
@pytest.mark.asyncio
async def test_composite_key_erasure(
db,
integration_mongodb_config: ConnectionConfig,
Expand Down Expand Up @@ -425,6 +429,7 @@ async def test_composite_key_erasure(

@pytest.mark.integration_mongodb
@pytest.mark.integration
@pytest.mark.asyncio
async def test_access_erasure_type_conversion(
db,
integration_mongodb_config: ConnectionConfig,
Expand Down Expand Up @@ -504,6 +509,7 @@ async def test_access_erasure_type_conversion(


@pytest.mark.integration
@pytest.mark.asyncio
async def test_object_querying_mongo(
db,
privacy_request,
Expand Down Expand Up @@ -600,6 +606,7 @@ async def test_object_querying_mongo(


@pytest.mark.integration
@pytest.mark.asyncio
async def test_get_cached_data_for_erasures(
integration_postgres_config, integration_mongodb_config, policy, db
) -> None:
Expand Down Expand Up @@ -643,6 +650,7 @@ async def test_get_cached_data_for_erasures(


@pytest.mark.integration
@pytest.mark.asyncio
async def test_return_all_elements_config_access_request(
db,
privacy_request,
Expand Down Expand Up @@ -695,6 +703,7 @@ async def test_return_all_elements_config_access_request(


@pytest.mark.integration
@pytest.mark.asyncio
async def test_return_all_elements_config_erasure(
db,
mongo_inserts,
Expand Down Expand Up @@ -773,6 +782,7 @@ async def test_return_all_elements_config_erasure(


@pytest.mark.integration
@pytest.mark.asyncio
async def test_array_querying_mongo(
db,
privacy_request,
Expand Down
Loading

0 comments on commit 9331949

Please sign in to comment.