Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W42 dependency updates #3686

Merged
merged 8 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# contact based on a user
- object: Contact
include: SFStandardContact
fields:
__user:
SalesforceQuery.find_record:
Expand Down
2 changes: 1 addition & 1 deletion cumulusci/tasks/marketing_cloud/get_user_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def _run_task(self):
payload = self.mc_config.get_user_info()
except requests.exceptions.HTTPError as e:
self.logger.error(
f"Exception occurred fetching user info: {e.response.text}"
f"Exception occurred fetching user info: {e.response.text if e.response else 'None'}"
)
raise

Expand Down
2 changes: 1 addition & 1 deletion cumulusci/tasks/robotframework/libdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def to_tuples(self):
# we don't want to see the same base pageobject
# keywords a kajillion times. This should probably
# be configurable, but I don't need it to be right now.
if base_pageobjects_path in keyword.source:
if base_pageobjects_path in str(keyword.source):
continue

path = Path(keyword.source)
Expand Down
21 changes: 15 additions & 6 deletions cumulusci/tasks/robotframework/robotframework.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import fnmatch
import json
import os
import shlex
import subprocess
import sys
from pathlib import Path

from robot import pythonpathsetter
from robot import run as robot_run
from robot.testdoc import testdoc

Expand Down Expand Up @@ -278,11 +278,8 @@ def _run_task(self):
# Save it so that we can restore it later
orig_sys_path = sys.path.copy()

# Add each source to PYTHONPATH. Robot recommends that we
# use pythonpathsetter instead of directly setting
# sys.path. <shrug>
for path in source_paths.values():
pythonpathsetter.add_path(path, end=True)
add_path(path, end=True)

# Make sure the path to the repo root is on sys.path. Normally
# it will be, but if we're running this task from another repo
Expand All @@ -293,7 +290,7 @@ def _run_task(self):
# by robot.run. Plus, robot recommends we call a special
# function instead of directly modifying sys.path
if self.project_config.repo_root not in sys.path:
pythonpathsetter.add_path(self.project_config.repo_root)
add_path(self.project_config.repo_root)

options["stdout"] = sys.stdout
options["stderr"] = sys.stderr
Expand Down Expand Up @@ -380,4 +377,16 @@ def execute_script(self, script, *args):
WebDriver.execute_script = execute_script


def add_path(path, end=False):
"""
Adds a source to PYTHONPATH. Robot recommended that we
use pythonpathsetter.add_path instead of directly setting
sys.path, but removed this function in v6.1.
"""
if not end:
sys.path.insert(0, path)
elif not any(fnmatch.fnmatch(p, path) for p in sys.path):
sys.path.append(path)


patch_executescript()
10 changes: 3 additions & 7 deletions cumulusci/tasks/robotframework/tests/test_robotframework.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_tagstatexclude(self, mock_robot_run):
},
},
)
assert type(task.options["options"]["tagstatexclude"]) == list
assert type(task.options["options"]["tagstatexclude"]) is list
task()
outputdir = str(Path(".").resolve())
mock_robot_run.assert_called_once_with(
Expand Down Expand Up @@ -266,9 +266,7 @@ def test_user_defined_listeners_option(self):
assert KeywordLogger in listener_classes

@mock.patch("cumulusci.tasks.robotframework.robotframework.robot_run")
@mock.patch(
"cumulusci.tasks.robotframework.robotframework.pythonpathsetter.add_path"
)
@mock.patch("cumulusci.tasks.robotframework.robotframework.add_path")
def test_sources(self, mock_add_path, mock_robot_run):
"""Verify that sources get added to PYTHONPATH when task runs"""
universal_config = UniversalConfig()
Expand Down Expand Up @@ -313,9 +311,7 @@ def test_sources(self, mock_add_path, mock_robot_run):
)

@mock.patch("cumulusci.tasks.robotframework.robotframework.robot_run")
@mock.patch(
"cumulusci.tasks.robotframework.robotframework.pythonpathsetter.add_path"
)
@mock.patch("cumulusci.tasks.robotframework.robotframework.add_path")
def test_repo_root_in_sys_path(self, mock_add_path, mock_robot_run):
"""Verify that the repo root is added to sys.path

Expand Down
17 changes: 3 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ dependencies = [
"keyring<=23.0.1",
"defusedxml",
"lxml",
"markdown-it-py==2.2.0", # resolve dependency conflict between prod/dev
"MarkupSafe",
"psutil",
"pydantic",
"pydantic<2",
"PyJWT",
"pytz",
"pyyaml",
Expand Down Expand Up @@ -73,7 +74,7 @@ test = [
"responses",
"testfixtures",
"tox",
"typeguard",
"typeguard<=2.13.3", # TODO: Lots of changes required for v4
"vcrpy"
]

Expand Down Expand Up @@ -173,8 +174,6 @@ include = [
'cumulusci/core/config/base_config.py',
'cumulusci/core/config/base_task_flow_config.py',
'cumulusci/core/config/oauth2_service_config.py',
'cumulusci/core/config/scratch_org_config.py',
'cumulusci/core/config/sfdx_org_config.py',
'cumulusci/core/debug.py',
'cumulusci/core/dependencies/__init__.py',
'cumulusci/core/dependencies/utils.py',
Expand All @@ -184,7 +183,6 @@ include = [
'cumulusci/core/metadeploy/__init__.py',
'cumulusci/core/metadeploy/api.py',
'cumulusci/core/runtime.py',
'cumulusci/core/sfdx.py',
'cumulusci/core/source/__init__.py',
'cumulusci/core/source/local_folder.py',
'cumulusci/core/source_transforms/__init__.py',
Expand All @@ -199,7 +197,6 @@ include = [
'cumulusci/salesforce_api/exceptions.py',
'cumulusci/salesforce_api/filterable_objects.py',
'cumulusci/salesforce_api/mc_soap_envelopes.py',
'cumulusci/salesforce_api/org_schema_models.py',
'cumulusci/salesforce_api/package_install.py',
'cumulusci/salesforce_api/soap_envelopes.py',
'cumulusci/tasks/__init__.py',
Expand All @@ -212,17 +209,10 @@ include = [
'cumulusci/tasks/bulkdata/generate_mapping_utils/extract_mapping_file_generator.py',
'cumulusci/tasks/bulkdata/generate_mapping_utils/generate_mapping_from_declarations.py',
'cumulusci/tasks/bulkdata/generate_mapping_utils/mapping_generator_post_processes.py',
'cumulusci/tasks/bulkdata/query_transformers.py',
'cumulusci/tasks/bulkdata/snowfakery_utils/snowfakery_working_directory.py',
'cumulusci/tasks/bulkdata/snowfakery_utils/subtask_configurator.py',
'cumulusci/tasks/dx_convert_from.py',
'cumulusci/tasks/github/__init__.py',
'cumulusci/tasks/github/commit_status.py',
'cumulusci/tasks/github/merge.py',
'cumulusci/tasks/github/publish.py',
'cumulusci/tasks/github/pull_request.py',
'cumulusci/tasks/github/release_report.py',
'cumulusci/tasks/github/tag.py',
'cumulusci/tasks/github/util.py',
'cumulusci/tasks/marketing_cloud/__init__.py',
'cumulusci/tasks/marketing_cloud/api.py',
Expand Down Expand Up @@ -263,7 +253,6 @@ include = [
'cumulusci/tests/util.py',
'cumulusci/utils/waiting.py',
'cumulusci/utils/xml/robot_xml.py',
'cumulusci/utils/xml/salesforce_encoding.py',
'cumulusci/utils/ziputils.py'
]
# Do not add to this list. Instead use
Expand Down
Loading
Loading