pybuilder-integration 105__tar.gz → 106__tar.gz

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.
Files changed (19) hide show
  1. {pybuilder_integration-105 → pybuilder_integration-106}/PKG-INFO +4 -3
  2. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration/tasks.py +56 -13
  3. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration.egg-info/PKG-INFO +4 -3
  4. pybuilder_integration-106/pybuilder_integration.egg-info/requires.txt +4 -0
  5. {pybuilder_integration-105 → pybuilder_integration-106}/setup.py +4 -3
  6. pybuilder_integration-105/pybuilder_integration.egg-info/requires.txt +0 -3
  7. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration/__init__.py +0 -0
  8. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration/artifact_manager.py +0 -0
  9. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration/cloudwatchlogs_utility.py +0 -0
  10. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration/directory_utility.py +0 -0
  11. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration/exec_utility.py +0 -0
  12. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration/properties.py +0 -0
  13. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration/tool_utility.py +0 -0
  14. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration.egg-info/SOURCES.txt +0 -0
  15. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration.egg-info/dependency_links.txt +0 -0
  16. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration.egg-info/namespace_packages.txt +0 -0
  17. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration.egg-info/top_level.txt +0 -0
  18. {pybuilder_integration-105 → pybuilder_integration-106}/pybuilder_integration.egg-info/zip-safe +0 -0
  19. {pybuilder_integration-105 → pybuilder_integration-106}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pybuilder-integration
3
- Version: 105
3
+ Version: 106
4
4
  Summary: A pybuilder plugin that runs integration tests (Tavern & Cypress) against a target.
5
5
  Home-page: https://github.com/rspitler/pybuilder-integration
6
6
  Author:
@@ -10,9 +10,10 @@ Maintainer-email:
10
10
  License: Apache 2.0
11
11
  Classifier: Development Status :: 3 - Alpha
12
12
  Classifier: Programming Language :: Python
13
- Requires-Dist: pytest
13
+ Requires-Dist: pytest==7.4.4
14
14
  Requires-Dist: tavern==1.25.2
15
- Requires-Dist: boto3
15
+ Requires-Dist: boto3==1.43.72
16
+ Requires-Dist: defusedxml==0.7.1
16
17
  Dynamic: classifier
17
18
  Dynamic: description
18
19
  Dynamic: home-page
@@ -3,9 +3,10 @@ import os
3
3
  import re
4
4
  import shutil
5
5
  import subprocess
6
- import sys
7
6
  import tempfile
8
- import xml.etree.ElementTree as ET
7
+
8
+ from defusedxml import ElementTree as ET
9
+ from defusedxml.common import DefusedXmlException
9
10
 
10
11
  import pytest
11
12
  from pybuilder.core import Project, Logger, RequirementsFile
@@ -27,6 +28,7 @@ from pybuilder_integration.tool_utility import install_cypress
27
28
  _VERIFY_ENVIRONMENT_SUBPROCESS_PROPERTIES = [
28
29
  INTEGRATION_ARTIFACT_BUCKET,
29
30
  ENVIRONMENT,
31
+ ENVIRONMENT_VARIABLES,
30
32
  ARTIFACT_MANAGER,
31
33
  CYPRESS_TEST_DIR,
32
34
  CYPRESS_CONFIG_FILE,
@@ -134,10 +136,54 @@ def _run_verify_environment_passes_in_subprocesses(project: Project, logger: Log
134
136
  if failures:
135
137
  raise BuildFailedException("Parallel verify_environment failed: " + "; ".join(failures))
136
138
  finally:
139
+ for _, process, _ in processes:
140
+ poll = getattr(process, "poll", None)
141
+ if callable(poll) and poll() is None:
142
+ process.terminate()
143
+ process.wait()
144
+ log_handle = getattr(process, "_pybuilder_integration_log_handle", None)
145
+ if log_handle and not log_handle.closed:
146
+ log_handle.close()
147
+ _merge_parallel_verify_environment_outputs(project, passes)
137
148
  if os.path.exists(properties_file):
138
149
  os.remove(properties_file)
139
150
 
140
151
 
152
+ def _merge_parallel_verify_environment_outputs(project: Project, passes):
153
+ parent_target = project.expand_path("$dir_target")
154
+ parent_logs_directory = prepare_logs_directory(project)
155
+ parent_output_directories = [
156
+ ("logs", parent_logs_directory),
157
+ ("reports", prepare_reports_directory(project)),
158
+ ]
159
+ parent_cypress_log = os.path.join(parent_logs_directory, "cypress_run.log")
160
+ has_parent_cypress_log = False
161
+ for pass_config in passes:
162
+ stage_target = os.path.join(parent_target, "verify_environment", pass_config["name"])
163
+ for output_directory, destination_directory in parent_output_directories:
164
+ source = os.path.join(stage_target, output_directory, "integration")
165
+ if os.path.exists(source):
166
+ destination = os.path.join(
167
+ destination_directory,
168
+ "parallel",
169
+ pass_config["name"],
170
+ )
171
+ shutil.copytree(source, destination, dirs_exist_ok=True)
172
+ if output_directory == "logs":
173
+ cypress_log = os.path.join(source, "cypress_run.log")
174
+ if os.path.exists(cypress_log):
175
+ _copy_cypress_log(cypress_log, parent_cypress_log, has_parent_cypress_log)
176
+ has_parent_cypress_log = True
177
+
178
+
179
+ def _copy_cypress_log(source, destination, append):
180
+ flags = os.O_WRONLY | os.O_CREAT | (os.O_APPEND if append else os.O_TRUNC)
181
+ mode = "ab" if append else "wb"
182
+ with open(source, "rb") as source_file:
183
+ with os.fdopen(os.open(destination, flags, 0o600), mode) as destination_file:
184
+ shutil.copyfileobj(source_file, destination_file)
185
+
186
+
141
187
  def _start_verify_environment_subprocess(project: Project, logger: Logger, pass_config, properties_file):
142
188
  log_file = os.path.join(prepare_logs_directory(project), f"verify_environment_{pass_config['name']}.log")
143
189
  command = _build_verify_environment_subprocess_command(project, pass_config)
@@ -166,9 +212,7 @@ def _start_verify_environment_subprocess(project: Project, logger: Logger, pass_
166
212
  def _build_verify_environment_subprocess_command(project: Project, pass_config):
167
213
  stage_target = os.path.join(project.expand_path("$dir_target"), "verify_environment", pass_config["name"])
168
214
  return [
169
- sys.executable,
170
- "-c",
171
- "from pybuilder.cli import main; main()",
215
+ "pyb",
172
216
  pass_config["task"],
173
217
  "-P", f"{WORKING_TEST_DIR}={pass_config['test_dir']}",
174
218
  "-P", f"{PARALLEL_VERIFY_ENVIRONMENT}=False",
@@ -191,13 +235,12 @@ def _collect_json_safe_project_properties(project: Project):
191
235
  safe_properties = {}
192
236
  for name in _VERIFY_ENVIRONMENT_SUBPROCESS_PROPERTIES:
193
237
  value = project.get_property(name, None)
194
- if value is None:
195
- continue
196
- try:
197
- json.dumps(value)
198
- except (TypeError, ValueError):
199
- continue
200
- safe_properties[name] = value
238
+ if value is not None:
239
+ try:
240
+ json.dumps(value)
241
+ except (TypeError, ValueError):
242
+ continue
243
+ safe_properties[name] = value
201
244
  return safe_properties
202
245
 
203
246
 
@@ -376,7 +419,7 @@ def _build_cypress_summary(log_path):
376
419
  name = tc.get("name", "")
377
420
  msg = (failure.get("message") or failure.text or "").split("\n")[0][:120]
378
421
  failures.append((f"{suite} > {name}", msg))
379
- except ET.ParseError:
422
+ except (ET.ParseError, DefusedXmlException):
380
423
  pass
381
424
 
382
425
  passed = total - failed - skipped
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pybuilder-integration
3
- Version: 105
3
+ Version: 106
4
4
  Summary: A pybuilder plugin that runs integration tests (Tavern & Cypress) against a target.
5
5
  Home-page: https://github.com/rspitler/pybuilder-integration
6
6
  Author:
@@ -10,9 +10,10 @@ Maintainer-email:
10
10
  License: Apache 2.0
11
11
  Classifier: Development Status :: 3 - Alpha
12
12
  Classifier: Programming Language :: Python
13
- Requires-Dist: pytest
13
+ Requires-Dist: pytest==7.4.4
14
14
  Requires-Dist: tavern==1.25.2
15
- Requires-Dist: boto3
15
+ Requires-Dist: boto3==1.43.72
16
+ Requires-Dist: defusedxml==0.7.1
16
17
  Dynamic: classifier
17
18
  Dynamic: description
18
19
  Dynamic: home-page
@@ -0,0 +1,4 @@
1
+ pytest==7.4.4
2
+ tavern==1.25.2
3
+ boto3==1.43.72
4
+ defusedxml==0.7.1
@@ -21,7 +21,7 @@ class install(_install):
21
21
  if __name__ == '__main__':
22
22
  setup(
23
23
  name = 'pybuilder-integration',
24
- version = '105',
24
+ version = '106',
25
25
  description = 'A pybuilder plugin that runs integration tests (Tavern & Cypress) against a target.',
26
26
  long_description = 'A pybuilder plugin that runs integration tests against a target. This is intended to be a broader scope than unit-tests encompassing dependant functionality.',
27
27
  long_description_content_type = None,
@@ -49,9 +49,10 @@ if __name__ == '__main__':
49
49
  data_files = [],
50
50
  package_data = {},
51
51
  install_requires = [
52
- 'pytest',
52
+ 'pytest==7.4.4',
53
53
  'tavern==1.25.2',
54
- 'boto3'
54
+ 'boto3==1.43.72',
55
+ 'defusedxml==0.7.1'
55
56
  ],
56
57
  extras_require = {},
57
58
  dependency_links = [],
@@ -1,3 +0,0 @@
1
- pytest
2
- tavern==1.25.2
3
- boto3