diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8df3ca7f..2119bfad 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,6 +11,10 @@ permissions: jobs: release: + # Releases are cut from the upstream repository only. Without this guard the + # workflow also runs on forks, where semantic-release rewrites the version in + # pyproject.toml, commits to the default branch and attempts a PyPI upload. + if: github.repository == 'appium/python-client' runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 diff --git a/appium/options/common/base.py b/appium/options/common/base.py index 5bd4f1a9..2de5a5f9 100644 --- a/appium/options/common/base.py +++ b/appium/options/common/base.py @@ -109,7 +109,7 @@ def process_key(k: str) -> str: return key return key if ':' in key else f'{APPIUM_PREFIX}{key}' - processed_caps = {process_key(k): v for k, v in copy.deepcopy(capabilities).items()} + processed_caps = {process_key(k): v for k, v in capabilities.items()} return {'capabilities': {'firstMatch': [{}], 'alwaysMatch': processed_caps}} def to_w3c(self) -> dict: diff --git a/test/unit/options/options_test.py b/test/unit/options/options_test.py new file mode 100644 index 00000000..6692eb9a --- /dev/null +++ b/test/unit/options/options_test.py @@ -0,0 +1,27 @@ +from appium.options.common.base import AppiumOptions + + +def test_as_w3c(): + caps = { + 'platformName': 'Android', + 'platformVersion': '11.0', + 'deviceName': 'Android Emulator', + 'automationName': 'UiAutomator2', + 'app': '/path/to/app.apk', + 'customCap': 'customValue', + } + res = AppiumOptions.as_w3c(caps) + expected = { + 'capabilities': { + 'firstMatch': [{}], + 'alwaysMatch': { + 'platformName': 'Android', + 'appium:platformVersion': '11.0', + 'appium:deviceName': 'Android Emulator', + 'appium:automationName': 'UiAutomator2', + 'appium:app': '/path/to/app.apk', + 'appium:customCap': 'customValue', + }, + } + } + assert res == expected