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

pydocstyle check: add leading underscore (PT004) #43852

Merged
merged 2 commits into from
Nov 9, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class TestBatchJobCollection:
"""Tests BatchJobCollection Class"""

@pytest.fixture(autouse=True)
def setup_method(self):
def _setup_method(self):
"""
Create a BatchJobCollection object and add 2 airflow tasks. Populates self.collection,
self.first/second_task, self.first/second_airflow_key, and self.first/second_airflow_cmd.
Expand Down Expand Up @@ -148,7 +148,7 @@ class TestBatchJob:
"""Tests the BatchJob DTO"""

@pytest.fixture(autouse=True)
def setup_method(self):
def _setup_method(self):
self.all_statuses = ["SUBMITTED", "PENDING", "RUNNABLE", "STARTING", "RUNNING", "SUCCEEDED", "FAILED"]
self.running = "RUNNING"
self.success = "SUCCEEDED"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ def mock_executor(set_env_vars) -> AwsEcsExecutor:
class TestEcsTaskCollection:
"""Tests EcsTaskCollection Class."""

# You can't use a fixture in setup_method unless you declare setup_method to be a fixture itself.
# You can't use a fixture in _setup_method unless you declare _setup_method to be a fixture itself.
@pytest.fixture(autouse=True)
def setup_method(self, mock_airflow_key):
def _setup_method(self, mock_airflow_key):
# Create a new Collection and verify it is empty.
self.collection = EcsTaskCollection()
assert len(self.collection) == 0
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/operators/test_athena.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

class TestAthenaOperator:
@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
args = {
"owner": "airflow",
"start_date": DEFAULT_DATE,
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/operators/test_ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def patch_hook_waiters():

class EcsBaseTestCase:
@pytest.fixture(autouse=True)
def setup_test_cases(self, monkeypatch):
def _setup_test_cases(self, monkeypatch):
self.client = boto3.client("ecs", region_name="eu-west-3")
monkeypatch.setattr(EcsHook, "conn", self.client)
monkeypatch.setenv("AIRFLOW_CONN_AWS_TEST_CONN", '{"conn_type": "aws"}')
Expand Down
4 changes: 2 additions & 2 deletions providers/tests/amazon/aws/operators/test_glacier.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class TestGlacierCreateJobOperator(BaseGlacierOperatorsTests):
op_class = GlacierCreateJobOperator

@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
self.default_op_kwargs = {"vault_name": VAULT_NAME, "task_id": TASK_ID}

@mock.patch.object(GlacierCreateJobOperator, "hook", new_callable=mock.PropertyMock)
Expand All @@ -89,7 +89,7 @@ class TestGlacierUploadArchiveOperator(BaseGlacierOperatorsTests):
op_class = GlacierUploadArchiveOperator

@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
self.default_op_kwargs = {"vault_name": VAULT_NAME, "task_id": TASK_ID, "body": b"Test Data"}

def test_execute(self):
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/operators/test_sns.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

class TestSnsPublishOperator:
@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
self.default_op_kwargs = {
"task_id": TASK_ID,
"target_arn": TARGET_ARN,
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/operators/test_sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def mocked_context():

class TestSqsPublishOperator:
@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
self.default_op_kwargs = {
"task_id": "test_task",
"message_content": "hello",
Expand Down
4 changes: 2 additions & 2 deletions providers/tests/amazon/aws/operators/test_step_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TestStepFunctionGetExecutionOutputOperator:
TASK_ID = "step_function_get_execution_output"

@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
with mock.patch(
"airflow.providers.amazon.aws.links.step_function.StateMachineExecutionsDetailsLink.persist"
) as executions_details_link:
Expand Down Expand Up @@ -117,7 +117,7 @@ class TestStepFunctionStartExecutionOperator:
TASK_ID = "step_function_start_execution_task"

@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
with (
mock.patch(
"airflow.providers.amazon.aws.links.step_function.StateMachineExecutionsDetailsLink.persist"
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/sensors/test_ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

class EcsBaseTestCase:
@pytest.fixture(autouse=True)
def setup_test_cases(self, monkeypatch, request, create_task_instance_of_operator, session):
def _setup_test_cases(self, monkeypatch, request, create_task_instance_of_operator, session):
self.dag_id = f"dag-{slugify(request.cls.__name__)}"
self.task_id = f"task-{slugify(request.node.name, max_length=40)}"
self.fake_client = boto3.client("ecs", region_name="eu-west-3")
Expand Down
6 changes: 3 additions & 3 deletions providers/tests/amazon/aws/sensors/test_eks.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

class TestEksClusterStateSensor:
@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
self.target_state = ClusterStates.ACTIVE
self.sensor = EksClusterStateSensor(
task_id=TASK_ID,
Expand Down Expand Up @@ -108,7 +108,7 @@ def test_poke_reached_unexpected_terminal_state(self, mock_get_cluster_state, un

class TestEksFargateProfileStateSensor:
@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
self.target_state = FargateProfileStates.ACTIVE
self.sensor = EksFargateProfileStateSensor(
task_id=TASK_ID,
Expand Down Expand Up @@ -156,7 +156,7 @@ def test_poke_reached_unexpected_terminal_state(

class TestEksNodegroupStateSensor:
@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
self.target_state = NodegroupStates.ACTIVE
self.sensor = EksNodegroupStateSensor(
task_id=TASK_ID,
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/sensors/test_sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def mocked_client():

class TestSqsSensor:
@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
self.default_op_kwargs = {
"task_id": "test_task",
"aws_conn_id": None,
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/triggers/test_sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

class TestSqsTriggers:
@pytest.fixture(autouse=True)
def setup_test_cases(self):
def _setup_test_cases(self):
self.sqs_trigger = SqsSensorTrigger(
sqs_queue=TEST_SQS_QUEUE,
aws_conn_id=TEST_AWS_CONN_ID,
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/waiters/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestCustomBatchServiceWaiters:
JOB_ID = "test_job_id"

@pytest.fixture(autouse=True)
def setup_test_cases(self, monkeypatch):
def _setup_test_cases(self, monkeypatch):
self.client = boto3.client("batch", region_name="eu-west-3")
monkeypatch.setattr(BatchClientHook, "conn", self.client)

Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/waiters/test_dynamo.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TestCustomDynamoDBServiceWaiters:
IMPORT_STATUS_IN_PROGRESS = "IN_PROGRESS"

@pytest.fixture(autouse=True)
def setup_test_cases(self, monkeypatch):
def _setup_test_cases(self, monkeypatch):
self.resource = boto3.resource("dynamodb", region_name="eu-west-3")
monkeypatch.setattr(DynamoDBHook, "conn", self.resource)
self.client = self.resource.meta.client
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/waiters/test_ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class TestCustomECSServiceWaiters:
@pytest.fixture(autouse=True)
def setup_test_cases(self, monkeypatch):
def _setup_test_cases(self, monkeypatch):
self.client = boto3.client("ecs", region_name="eu-west-3")
monkeypatch.setattr(EcsHook, "conn", self.client)

Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/waiters/test_emr.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TestCustomEmrServiceWaiters:
STEP_ID2 = "test_step_id_2"

@pytest.fixture(autouse=True)
def setup_test_cases(self, monkeypatch):
def _setup_test_cases(self, monkeypatch):
self.client = boto3.client("emr", region_name="eu-west-3")
monkeypatch.setattr(EmrHook, "conn", self.client)

Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/waiters/test_glue_databrew.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TestCustomDataBrewWaiters:
RUN_ID = "123"

@pytest.fixture(autouse=True)
def setup_test_cases(self, monkeypatch):
def _setup_test_cases(self, monkeypatch):
self.client = boto3.client("databrew", region_name="eu-west-3")
monkeypatch.setattr(GlueDataBrewHook, "conn", self.client)

Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/waiters/test_neptune.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TestCustomNeptuneWaiters:
"""Test waiters from ``amazon/aws/waiters/neptune.json``."""

@pytest.fixture(autouse=True)
def setup_test_cases(self, monkeypatch):
def _setup_test_cases(self, monkeypatch):
self.client = boto3.client("neptune", region_name="eu-west-3")
monkeypatch.setattr(NeptuneHook, "conn", self.client)

Expand Down