pybuilder-integration 85__tar.gz → 86__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 (18) hide show
  1. {pybuilder-integration-85 → pybuilder-integration-86}/PKG-INFO +1 -1
  2. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration/properties.py +1 -0
  3. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration/tasks.py +36 -23
  4. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration.egg-info/PKG-INFO +1 -1
  5. {pybuilder-integration-85 → pybuilder-integration-86}/setup.py +1 -1
  6. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration/__init__.py +0 -0
  7. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration/artifact_manager.py +0 -0
  8. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration/cloudwatchlogs_utility.py +0 -0
  9. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration/directory_utility.py +0 -0
  10. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration/exec_utility.py +0 -0
  11. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration/tool_utility.py +0 -0
  12. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration.egg-info/SOURCES.txt +0 -0
  13. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration.egg-info/dependency_links.txt +0 -0
  14. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration.egg-info/namespace_packages.txt +0 -0
  15. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration.egg-info/requires.txt +0 -0
  16. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration.egg-info/top_level.txt +0 -0
  17. {pybuilder-integration-85 → pybuilder-integration-86}/pybuilder_integration.egg-info/zip-safe +0 -0
  18. {pybuilder-integration-85 → pybuilder-integration-86}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybuilder-integration
3
- Version: 85
3
+ Version: 86
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:
@@ -3,6 +3,7 @@ ENVIRONMENT = "ENVIRONMENT"
3
3
  ENVIRONMENT_VARIABLES = "cypress_environment_variables"
4
4
  ARTIFACT_MANAGER = "integration_artifact_manager"
5
5
  CYPRESS_TEST_DIR = "cypress_test_dir"
6
+ CYPRESS_CONFIG_FILE = "cypress_config_file"
6
7
  INTEGRATION_TARGET_URL = "integration_target_url"
7
8
  TAVERN_ADDITIONAL_ARGS = "tavern_addition_args"
8
9
  WORKING_TEST_DIR = "verify_environment_new_test_dir"
@@ -2,7 +2,7 @@ import os
2
2
  import shutil
3
3
 
4
4
  import pytest
5
- from pybuilder.core import Project, Logger, init, RequirementsFile
5
+ from pybuilder.core import Project, Logger, RequirementsFile
6
6
  from pybuilder.errors import BuildFailedException
7
7
  from pybuilder.install_utils import install_dependencies
8
8
  from pybuilder.reactor import Reactor
@@ -11,7 +11,7 @@ from pybuilder.utils import Timer
11
11
  from pybuilder_integration import exec_utility, tool_utility
12
12
  from pybuilder_integration.artifact_manager import get_artifact_manager
13
13
  from pybuilder_integration.cloudwatchlogs_utility import CloudwatchLogs
14
- from pybuilder_integration.directory_utility import prepare_dist_directory, get_working_distribution_directory, \
14
+ from pybuilder_integration.directory_utility import get_working_distribution_directory, \
15
15
  package_artifacts, prepare_reports_directory, get_local_zip_artifact_path, prepare_logs_directory
16
16
  from pybuilder_integration.properties import *
17
17
  from pybuilder_integration.tool_utility import install_cypress
@@ -24,7 +24,8 @@ def integration_artifact_push(project: Project, logger: Logger, reactor: Reactor
24
24
  artifact_file = get_local_zip_artifact_path(tool=tool, project=project, include_ending=True)
25
25
  if os.path.exists(artifact_file):
26
26
  logger.info(
27
- f"Starting upload of integration artifact: {os.path.basename(artifact_file)} to: {manager.friendly_name}")
27
+ f"Starting upload of integration artifact: {os.path.basename(artifact_file)} to: {manager.friendly_name}"
28
+ )
28
29
  manager.upload(file=artifact_file, project=project, logger=logger, reactor=reactor)
29
30
 
30
31
 
@@ -39,9 +40,9 @@ def verify_environment(project: Project, logger: Logger, reactor: Reactor):
39
40
  integration_artifact_push(project=project, logger=logger, reactor=reactor)
40
41
 
41
42
 
42
- def _should_run_latest(dir, project):
43
+ def _should_run_latest(test_dir, project):
43
44
  if project.get_property(SHOULD_SKIP_LATEST, False):
44
- if project.get_property(ROLE) == dir:
45
+ if project.get_property(ROLE) == test_dir:
45
46
  return False
46
47
  return True
47
48
 
@@ -57,10 +58,10 @@ def _run_cypress_tests_in_dist_dir(dist_directory, latest, logger, project, reac
57
58
  if os.path.exists(cypress_test_path):
58
59
  logger.info(f"Found cypress tests - starting run latest: {latest}")
59
60
  if latest:
60
- for dir in os.listdir(cypress_test_path) :
61
- if os.path.isdir(f"{cypress_test_path}/{dir}")and _should_run_latest(dir, project):
62
- logger.info(f"Running {dir}")
63
- _run_cypress_tests_in_directory(work_dir=f"{cypress_test_path}/{dir}",
61
+ for test_dir in os.listdir(cypress_test_path):
62
+ if os.path.isdir(f"{cypress_test_path}/{test_dir}") and _should_run_latest(test_dir, project):
63
+ logger.info(f"Running {test_dir}")
64
+ _run_cypress_tests_in_directory(work_dir=f"{cypress_test_path}/{test_dir}",
64
65
  logger=logger,
65
66
  project=project,
66
67
  reactor=reactor)
@@ -79,14 +80,14 @@ def _run_tavern_tests_in_dist_dir(dist_directory, latest, logger, project, react
79
80
  if os.path.exists(tavern_test_path):
80
81
  logger.info(f"Found tavern tests - starting run latest: {latest}")
81
82
  if latest:
82
- for dir in os.listdir(tavern_test_path):
83
- if os.path.isdir(f"{tavern_test_path}/{dir}") and _should_run_latest(dir, project):
84
- logger.info(f"Running {dir}")
85
- _run_tavern_tests_in_dir(test_dir=f"{tavern_test_path}/{dir}",
83
+ for tavern_dir in os.listdir(tavern_test_path):
84
+ if os.path.isdir(f"{tavern_test_path}/{tavern_dir}") and _should_run_latest(tavern_dir, project):
85
+ logger.info(f"Running {tavern_dir}")
86
+ _run_tavern_tests_in_dir(test_dir=f"{tavern_test_path}/{tavern_dir}",
86
87
  logger=logger,
87
88
  project=project,
88
89
  reactor=reactor,
89
- role=os.path.basename(dir))
90
+ role=os.path.basename(tavern_dir))
90
91
  else:
91
92
  _run_tavern_tests_in_dir(test_dir=f"{tavern_test_path}",
92
93
  logger=logger,
@@ -128,14 +129,14 @@ def _run_cypress_tests_in_directory(work_dir, logger, project, reactor: Reactor)
128
129
  f"mochaFile={results_file}"]
129
130
  if project.get_property("record_cypress", True):
130
131
  args.append('--record')
131
- _add_config_file(args, environment, work_dir)
132
+ _add_config_file(project, args, environment, work_dir)
132
133
  environment_variables = project.get_property(ENVIRONMENT_VARIABLES, {})
133
134
  logger.info(f"Running cypress on host: {target_url}")
134
135
  exec_utility.exec_command(command_name=executable, args=args,
135
136
  failure_message="Failed to execute cypress tests", log_file_name='cypress_run.log',
136
137
  project=project, reactor=reactor, logger=logger, working_dir=work_dir, report=False,
137
138
  env_vars=environment_variables)
138
- # workaround but cypress output are relative to location of cypress.json so we need to collapse
139
+ # workaround but cypress output are relative to location of cypress.json, so we need to collapse
139
140
  if os.path.exists(f"{work_dir}/target"):
140
141
  shutil.copytree(f"{work_dir}/target", "./target", dirs_exist_ok=True)
141
142
  total_time.stop()
@@ -143,13 +144,25 @@ def _run_cypress_tests_in_directory(work_dir, logger, project, reactor: Reactor)
143
144
  return True
144
145
 
145
146
 
146
- def _add_config_file(args, environment, work_dir):
147
- for ending in ['ts','json']:
148
- config_file_path = f'{environment}-config.{ending}'
149
- if os.path.exists(os.path.join(work_dir, config_file_path)):
150
- args.append("--config-file")
151
- args.append(config_file_path)
152
- return
147
+ def _add_config_file(project, args, environment, work_dir):
148
+
149
+ # Environment variable override
150
+ cypress_config_file_override = os.environ.get('CYPRESS_CONFIG_FILE')
151
+ if cypress_config_file_override:
152
+ project.set_property(CYPRESS_CONFIG_FILE, cypress_config_file_override)
153
+
154
+ # Check project for config file else test file system for environment named file
155
+ cypress_config_file = project.get_property(CYPRESS_CONFIG_FILE)
156
+ if cypress_config_file and os.path.exists(os.path.join(work_dir, cypress_config_file)):
157
+ args.append("--config-file")
158
+ args.append(cypress_config_file)
159
+ else:
160
+ for ending in ['ts', 'json']:
161
+ config_file_path = f'{environment}-config.{ending}'
162
+ if os.path.exists(os.path.join(work_dir, config_file_path)):
163
+ args.append("--config-file")
164
+ args.append(config_file_path)
165
+ return
153
166
 
154
167
 
155
168
  def verify_tavern(project: Project, logger: Logger, reactor: Reactor):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybuilder-integration
3
- Version: 85
3
+ Version: 86
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:
@@ -21,7 +21,7 @@ class install(_install):
21
21
  if __name__ == '__main__':
22
22
  setup(
23
23
  name = 'pybuilder-integration',
24
- version = '85',
24
+ version = '86',
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,