hardpy 0.18.0__py3-none-any.whl → 0.18.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
hardpy/cli/cli.py CHANGED
@@ -330,9 +330,13 @@ def _validate_running_config(config: HardpyConfig, tests_dir: str) -> None:
330
330
  sys.exit()
331
331
 
332
332
  def _validate_config(config: HardpyConfig) -> None:
333
- if config.stand_cloud.autosync_timeout < 1:
334
- print("StandCloud autosync timeout must be greater than 0.")
335
- sys.exit()
333
+ if config.stand_cloud.autosync:
334
+ if config.stand_cloud.autosync_timeout < 1:
335
+ print("StandCloud autosync timeout must be greater than 0.")
336
+ sys.exit()
337
+ if not config.stand_cloud.api_key:
338
+ print("StandCloud API key is empty.")
339
+ sys.exit()
336
340
 
337
341
 
338
342
  def _request_hardpy(url: str, timeout: int = 5) -> str:
@@ -166,7 +166,7 @@ class StandCloudConnector:
166
166
  except OAuth2Error as exc:
167
167
  raise StandCloudError(exc.description) from exc
168
168
  except RequestException as exc:
169
- raise StandCloudError(exc.strerror) from exc # type: ignore
169
+ raise StandCloudError(exc.strerror or str(exc)) from exc # type: ignore
170
170
 
171
171
  return resp
172
172
 
@@ -4,6 +4,3 @@
4
4
 
5
5
  class StandCloudError(Exception):
6
6
  """Base StandCloud error."""
7
-
8
- def __init__(self, msg: str) -> None:
9
- super().__init__(f"StandCloud error: {msg}")
@@ -124,6 +124,8 @@ class TokenManager:
124
124
  storage_keyring = load_keyring("keyring.backends.SecretService.Keyring")
125
125
  elif system() == "Windows":
126
126
  storage_keyring = load_keyring("keyring.backends.Windows.WinVaultKeyring")
127
+ elif system() == "Darwin":
128
+ storage_keyring = load_keyring("keyring.backends.macOS.KeyChain")
127
129
  # TODO(xorialexandrov): add memory keyring or other store
128
130
  mem_keyring = storage_keyring
129
131
 
@@ -93,9 +93,8 @@ async def sync_stand_cloud(sc_sync_interval_minutes: int) -> None:
93
93
  except asyncio.CancelledError:
94
94
  logger.info("StandCloud synchronization task cancelled.")
95
95
  break
96
- except Exception: # noqa: BLE001
97
- # TODO (xorialexandrov): add more information to logging
98
- logger.info("Error during StandCloud synchronization")
96
+ except Exception as exc: # noqa: BLE001
97
+ logger.info(f"Error during StandCloud synchronization. {exc}")
99
98
  await asyncio.sleep(sc_sync_interval)
100
99
 
101
100
 
@@ -208,12 +207,11 @@ async def stand_cloud_sync() -> dict:
208
207
  app.state.executor,
209
208
  app.state.sc_synchronizer.sync,
210
209
  )
211
- except Exception: # noqa: BLE001
212
- msg = "Error during StandCloud synchronization"
213
- # TODO (xorialexandrov): add more information to logging
214
- logger.info("Error during StandCloud synchronization")
210
+ except Exception as exc: # noqa: BLE001
211
+ msg = f"Error during StandCloud synchronization. {exc}"
212
+ logger.info(msg)
215
213
  return {"status": msg}
216
- logger.info(f"StandCloud sucnronization status: {sync_result}")
214
+ logger.info(f"StandCloud syncronization status: {sync_result}")
217
215
  return {"status": sync_result}
218
216
 
219
217
 
@@ -140,10 +140,10 @@ class HardpyPlugin:
140
140
  self._start_args = {}
141
141
  self._sc_syncronizer = StandCloudSynchronizer()
142
142
 
143
- if system() == "Linux":
144
- signal.signal(signal.SIGTERM, self._stop_handler)
145
- elif system() == "Windows":
143
+ if system() == "Windows":
146
144
  signal.signal(signal.SIGBREAK, self._stop_handler) # type: ignore
145
+ else:
146
+ signal.signal(signal.SIGTERM, self._stop_handler)
147
147
  self._log = getLogger(__name__)
148
148
 
149
149
  # Initialization hooks
@@ -65,7 +65,7 @@ class PyTestWrapper:
65
65
  cwd=self._config_manager.tests_path,
66
66
  creationflags=subprocess.CREATE_NEW_PROCESS_GROUP,
67
67
  )
68
- if system() == "Linux":
68
+ else:
69
69
  self._proc = subprocess.Popen( # noqa: S603
70
70
  cmd,
71
71
  cwd=self._config_manager.tests_path,
@@ -80,10 +80,10 @@ class PyTestWrapper:
80
80
  bool: True if pytest was running and stopped
81
81
  """
82
82
  if self.is_running() and self._proc:
83
- if system() == "Linux":
84
- self._proc.terminate()
85
- elif system() == "Windows":
83
+ if system() == "Windows":
86
84
  self._proc.send_signal(signal.CTRL_BREAK_EVENT) # type: ignore
85
+ else:
86
+ self._proc.terminate()
87
87
  return True
88
88
  return False
89
89
 
@@ -31,10 +31,7 @@ class StandCloudSynchronizer:
31
31
  """
32
32
  if not self._tempstore.reports():
33
33
  return "All reports are synchronized with StandCloud"
34
- try:
35
- loader = self._create_sc_loader()
36
- except StandCloudError as err:
37
- raise StandCloudError(str(err)) from err
34
+ loader = self._create_sc_loader()
38
35
 
39
36
  invalid_reports = []
40
37
  success_report_counter = 0
@@ -117,5 +114,13 @@ class StandCloudSynchronizer:
117
114
 
118
115
  def _create_sc_loader(self) -> StandCloudLoader:
119
116
  loader = StandCloudLoader()
120
- loader.healthcheck()
117
+ response = loader.healthcheck()
118
+ if response.status_code != HTTPStatus.OK:
119
+ url = response.url
120
+ code = response.status_code
121
+ msg = f"StandCloud healthcheck at {url} is unavailable, status code: {code}"
122
+ raise StandCloudError(msg)
123
+ if response.status_code == HTTPStatus.OK and response.text != "{}":
124
+ msg = f"StandCloud healthcheck at {response.url} is unavailable"
125
+ raise StandCloudError(msg)
121
126
  return loader
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hardpy
3
- Version: 0.18.0
3
+ Version: 0.18.2
4
4
  Summary: HardPy library for device testing
5
5
  Project-URL: Homepage, https://github.com/everypinio/hardpy/
6
6
  Project-URL: Documentation, https://everypinio.github.io/hardpy/
@@ -1,19 +1,19 @@
1
1
  hardpy/__init__.py,sha256=B99MElYhd8HHgOJaT-RVPyvIN18uPaG2pb78TJ3lqvE,2957
2
2
  hardpy/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- hardpy/cli/cli.py,sha256=L-yFMcMTm3JY3s1eK83q5sHxrF8altU8rhrwSF9VNG8,11195
3
+ hardpy/cli/cli.py,sha256=eg89XAcPSosykXyeWitcTigE-ZYiDeCknPWp9TpXxeA,11359
4
4
  hardpy/cli/template.py,sha256=kOl8hsj6iBTFIDUli_dzHkH8mlnoJzOlr9muLpTEayg,6230
5
5
  hardpy/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  hardpy/common/config.py,sha256=t1ij_-PiIuhIgXD0PP2fZeRJF-gQGGxthYsu1PQmDGQ,6430
7
7
  hardpy/common/singleton.py,sha256=RVMqbluN-mhlJ4QOYcRzQLA68Hs8t83XNyihyUwhYGo,948
8
8
  hardpy/common/stand_cloud/__init__.py,sha256=fezdiYAehtT2H-GAef-xZU12CbmCRe64XHA9UB3kJDU,456
9
- hardpy/common/stand_cloud/connector.py,sha256=OegkuPH8Vxo_cWjiNRHzY4ONmDGWzZbz8K7Y_WeCgUc,8135
10
- hardpy/common/stand_cloud/exception.py,sha256=eKkqu5ylDRIGN_yZhvz2xVGm49XmlZ8nryALgdRqpbY,287
9
+ hardpy/common/stand_cloud/connector.py,sha256=PD1Gr1QOuFUmCsnlPY2zb_WF9Nrr8BGTlbRC2_LTKFE,8147
10
+ hardpy/common/stand_cloud/exception.py,sha256=zzFlW3Pg8ihG7t-Fb-KvfhDIE5l6oAg9Pdghse8Ib4U,191
11
11
  hardpy/common/stand_cloud/oauth2.py,sha256=SDqtIwcuMgqfBkEZyo3GXeVPnvRBOr6dzeXowx3ZkEw,2803
12
12
  hardpy/common/stand_cloud/registration.py,sha256=UW-JGcvON5CMQQ-s2Mb4Ee3u_jmdQfSj3vPfZ_FuhHY,2370
13
- hardpy/common/stand_cloud/token_manager.py,sha256=0s4fdYrjAonv1DCzTE5D-fF6drZJ3AhTDUoCRlSlK68,4730
13
+ hardpy/common/stand_cloud/token_manager.py,sha256=oHLDip0a-0mmAiRQN5IuypTSNyOnSB43TSWlprOLRI0,4843
14
14
  hardpy/common/stand_cloud/utils.py,sha256=GN3wzbrmF-Xe5iUXf_HurGO-YKltqd3Gc_7vG2eEL7c,692
15
15
  hardpy/hardpy_panel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- hardpy/hardpy_panel/api.py,sha256=3zNdXldYGXSnf7bwE-oqoI8xE0H1shwOWg3_bkUGCvs,8149
16
+ hardpy/hardpy_panel/api.py,sha256=KNT4z5WNgpOjujAtBSmrPXsDmA5hUJKVeLZ6Ah9u_nk,8007
17
17
  hardpy/hardpy_panel/frontend/dist/favicon.ico,sha256=sgIk5PKUKEKBDpkSrc8dJgjpObp0iF82Mec0GpfKId4,15406
18
18
  hardpy/hardpy_panel/frontend/dist/index.html,sha256=TOZiLD7WXiBB5W0GPF50u5zQtG0-gQ4Gd7n2757k-hU,1851
19
19
  hardpy/hardpy_panel/frontend/dist/logo192.png,sha256=E4K7drvhJCg9HcTpRihOXZhVJVBZ7-W97Se-3tDb46o,14485
@@ -46,9 +46,9 @@ hardpy/hardpy_panel/frontend/dist/locales/ja/translation.json,sha256=kGBJmHlhndu
46
46
  hardpy/hardpy_panel/frontend/dist/locales/ru/translation.json,sha256=81pqFajGhSwPwZV4j0HpziB1oX2iJ5Ud12cLiAaX8J0,3467
47
47
  hardpy/hardpy_panel/frontend/dist/locales/zh/translation.json,sha256=9W61N2MA15J5Zj6UqBqPmUDZXaRAH2HWm9m51BgvzJw,2322
48
48
  hardpy/pytest_hardpy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
- hardpy/pytest_hardpy/plugin.py,sha256=6If9k_gyXYH2Eow0d5ty2Kpb3Qsij17gb3DlqIXauWQ,23355
49
+ hardpy/pytest_hardpy/plugin.py,sha256=RqBZeIjdrV7szq0tShjqq6TkpWWBhzQN89KcCHSYhEo,23335
50
50
  hardpy/pytest_hardpy/pytest_call.py,sha256=qUDrK1iUjhGEs4bmBFTk9E0YfFzsePoHhVDRY6ngRV8,22878
51
- hardpy/pytest_hardpy/pytest_wrapper.py,sha256=bbk1BYy7CEBeg3Z2pcONb-xFzb3uDYLKcJV7316-Szo,4830
51
+ hardpy/pytest_hardpy/pytest_wrapper.py,sha256=U-tguwJsyW_lDAbFcEOgutc6G__PmWnhuHA6fCgePUc,4792
52
52
  hardpy/pytest_hardpy/db/__init__.py,sha256=nat_tUO2cxPIp9e6U8Fvg6V4NcZ9TVg27u0GHoKelD4,865
53
53
  hardpy/pytest_hardpy/db/base_store.py,sha256=d1lkTB7CpHTKysD2yuuGQFai44OtOmtTbq-WaBYojhw,5545
54
54
  hardpy/pytest_hardpy/db/const.py,sha256=E_A0IKGeS3qyPX4fTfUE5ksARsrTKSVWqUkdmh8S_fo,1414
@@ -71,7 +71,7 @@ hardpy/pytest_hardpy/result/report_reader/__init__.py,sha256=47DEQpj8HBSa-_TImW-
71
71
  hardpy/pytest_hardpy/result/report_reader/couchdb_reader.py,sha256=lnWSX-0QKbdMwtqfCtW0tiH9W_ZEPqQ3rb7Lc8gES7E,5726
72
72
  hardpy/pytest_hardpy/result/report_reader/stand_cloud_reader.py,sha256=uT7YSBu1QyURH9IkgRCdpbinn8LKXUhgVEhwPmGZV7I,3636
73
73
  hardpy/pytest_hardpy/result/report_synchronizer/__init__.py,sha256=QezaT_Yk8LrciygdsFPJeZn0EBUaKpd0GfCQjSuIo-I,273
74
- hardpy/pytest_hardpy/result/report_synchronizer/synchronizer.py,sha256=-RnYMhnZTDci0NniwnCoG5-Pg-R22TKWQLfyfTgyA_w,4309
74
+ hardpy/pytest_hardpy/result/report_synchronizer/synchronizer.py,sha256=c27we42R9OOlTnN8T0Zw_PRVxg4RNabug9PEq9Y9lNE,4652
75
75
  hardpy/pytest_hardpy/utils/__init__.py,sha256=zHln8ySBHesYAwYatLYkHol5TuuTTNOqrsMP7ONFEG0,1338
76
76
  hardpy/pytest_hardpy/utils/const.py,sha256=xS3jBrW_D6IUTlAjSnLiHvSthieRHCj3uN_6fFAXS0w,1832
77
77
  hardpy/pytest_hardpy/utils/dialog_box.py,sha256=eCLGQ-Z8rDPd_8ABHRtbkd7piSZcJoG-bCBmnyq29Pw,11375
@@ -79,8 +79,8 @@ hardpy/pytest_hardpy/utils/exception.py,sha256=1l2VBZLUnjPDoOs744MtaP7Y9FuXUq7ko
79
79
  hardpy/pytest_hardpy/utils/machineid.py,sha256=6JAzUt7KtjTYn8kL9hSMaCQ20U8liH-zDT9v-5Ch7Q8,296
80
80
  hardpy/pytest_hardpy/utils/node_info.py,sha256=DaW566WvsyWR66CThuZ38UoHwQa-pu-4WRLg61OXDnE,7134
81
81
  hardpy/pytest_hardpy/utils/progress_calculator.py,sha256=TPl2gG0ZSvMe8otPythhF9hkD6fa6-mJAhy9yI83-yE,1071
82
- hardpy-0.18.0.dist-info/METADATA,sha256=sZ2hohzC2kZlfrBnO5j3IjoJkfiSeElIsDjra0G2fQs,4983
83
- hardpy-0.18.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
- hardpy-0.18.0.dist-info/entry_points.txt,sha256=nL2sMkKMScNaOE0IPkYnu9Yr-BUswZvGSrwY-SxHY3E,102
85
- hardpy-0.18.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
86
- hardpy-0.18.0.dist-info/RECORD,,
82
+ hardpy-0.18.2.dist-info/METADATA,sha256=rIRCy0Wuyu1GRnE9NMm7kQY3CZvef_hP6XInfN28Shk,4983
83
+ hardpy-0.18.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
+ hardpy-0.18.2.dist-info/entry_points.txt,sha256=nL2sMkKMScNaOE0IPkYnu9Yr-BUswZvGSrwY-SxHY3E,102
85
+ hardpy-0.18.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
86
+ hardpy-0.18.2.dist-info/RECORD,,