3939NOTE: For the tests to find the conftest in the testing infrastructure,
4040 add the PYTHONPATH to the "env" in your noxfile_config.py file.
4141"""
42+
4243from collections .abc import Callable , Iterator
4344
4445import conftest # python-docs-samples/dataflow/conftest.py
@@ -70,8 +71,9 @@ def messages_topic(pubsub_topic: Callable[[str], str]) -> str:
7071
7172
7273@pytest .fixture (scope = "session" )
73- def messages_subscription (pubsub_subscription : Callable [[str , str ], str ],
74- messages_topic : str ) -> str :
74+ def messages_subscription (
75+ pubsub_subscription : Callable [[str , str ], str ], messages_topic : str
76+ ) -> str :
7577 return pubsub_subscription ("messages" , messages_topic )
7678
7779
@@ -81,20 +83,21 @@ def responses_topic(pubsub_topic: Callable[[str], str]) -> str:
8183
8284
8385@pytest .fixture (scope = "session" )
84- def responses_subscription (pubsub_subscription : Callable [[str , str ], str ],
85- responses_topic : str ) -> str :
86+ def responses_subscription (
87+ pubsub_subscription : Callable [[str , str ], str ], responses_topic : str
88+ ) -> str :
8689 return pubsub_subscription ("responses" , responses_topic )
8790
8891
8992@pytest .fixture (scope = "session" )
9093def dataflow_job (
91- project : str ,
92- bucket_name : str ,
93- location : str ,
94- unique_name : str ,
95- container_image : str ,
96- messages_subscription : str ,
97- responses_topic : str ,
94+ project : str ,
95+ bucket_name : str ,
96+ location : str ,
97+ unique_name : str ,
98+ container_image : str ,
99+ messages_subscription : str ,
100+ responses_topic : str ,
98101) -> Iterator [str ]:
99102 # Launch the streaming Dataflow pipeline.
100103 conftest .run_cmd (
@@ -127,20 +130,18 @@ def dataflow_job(
127130
128131@pytest .mark .timeout (3600 )
129132def test_pipeline_dataflow (
130- project : str ,
131- location : str ,
132- dataflow_job : str ,
133- messages_topic : str ,
134- responses_subscription : str ,
133+ project : str ,
134+ location : str ,
135+ dataflow_job : str ,
136+ messages_topic : str ,
137+ responses_subscription : str ,
135138) -> None :
136139 print (f"Waiting for the Dataflow workers to start: { dataflow_job } " )
137140 conftest .wait_until (
138- lambda : conftest .dataflow_num_workers (project , location , dataflow_job )
139- > 0 ,
141+ lambda : conftest .dataflow_num_workers (project , location , dataflow_job ) > 0 ,
140142 "workers are running" ,
141143 )
142- num_workers = conftest .dataflow_num_workers (project , location ,
143- dataflow_job )
144+ num_workers = conftest .dataflow_num_workers (project , location , dataflow_job )
144145 print (f"Dataflow job num_workers: { num_workers } " )
145146
146147 messages = ["This is a test for a Python sample." ]
0 commit comments