Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81265d2

Browse files
committed
linting and global vars
1 parent 8cd7dc6 commit 81265d2

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

data-science-onramp/data-ingestion/setup_test.py

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,49 +31,47 @@
3131
],
3232
},
3333
}
34-
35-
36-
@pytest.fixture(autouse=True)
37-
def setup_and_teardown_cluster():
38-
# Create cluster configuration
39-
cluster_data = {
40-
'project_id': PROJECT,
41-
'cluster_name': CLUSTER_NAME,
42-
'config': {
43-
'gce_cluster_config': {
44-
'zone_uri': '',
45-
"metadata": {
46-
"PIP_PACKAGES": "google-cloud-storage"
47-
},
34+
CLUSTER_DATA = { # Create cluster configuration
35+
'project_id': PROJECT,
36+
'cluster_name': CLUSTER_NAME,
37+
'config': {
38+
'gce_cluster_config': {
39+
'zone_uri': '',
40+
"metadata": {
41+
"PIP_PACKAGES": "google-cloud-storage"
4842
},
49-
'master_config': {
50-
'num_instances': 1,
51-
'machine_type_uri': 'n1-standard-8'
52-
},
53-
'worker_config': {
54-
'num_instances': 6,
55-
'machine_type_uri': 'n1-standard-8'
56-
},
57-
"initialization_actions": [
58-
{
59-
"executable_file": ("gs://dataproc-initialization-actions/"
60-
"python/pip-install.sh"),
61-
}
62-
],
63-
"software_config": {
64-
"image_version": "1.5.4-debian10",
65-
"optional_components": [
66-
"ANACONDA"
67-
],
43+
},
44+
'master_config': {
45+
'num_instances': 1,
46+
'machine_type_uri': 'n1-standard-8'
47+
},
48+
'worker_config': {
49+
'num_instances': 6,
50+
'machine_type_uri': 'n1-standard-8'
51+
},
52+
"initialization_actions": [
53+
{
54+
"executable_file": ("gs://dataproc-initialization-actions/"
55+
"python/pip-install.sh"),
6856
}
57+
],
58+
"software_config": {
59+
"image_version": "1.5.4-debian10",
60+
"optional_components": [
61+
"ANACONDA"
62+
],
6963
}
7064
}
65+
}
7166

67+
68+
@pytest.fixture(autouse=True)
69+
def setup_and_teardown_cluster():
7270
# Create cluster using cluster client
7371
cluster_client = dataproc.ClusterControllerClient(client_options={
7472
'api_endpoint': f'{REGION}-dataproc.googleapis.com:443'
7573
})
76-
operation = cluster_client.create_cluster(PROJECT, REGION, cluster_data)
74+
operation = cluster_client.create_cluster(PROJECT, REGION, CLUSTER_DATA)
7775

7876
# Wait for cluster to provision
7977
operation.result()
@@ -111,7 +109,7 @@ def get_blob_from_path(path):
111109

112110

113111
def is_in_table(value, out):
114-
return re.search(f"\| *{value}\|", out)
112+
return re.search(f"\\| *{value}\\|", out)
115113

116114

117115
def test_setup():

0 commit comments

Comments
 (0)