From a6fa21d54a6c5d255fa41517e3425cc6bd3d2dc3 Mon Sep 17 00:00:00 2001 From: "Rob Moore (MakerX)" Date: Mon, 17 Apr 2023 17:02:56 +0800 Subject: [PATCH] Stopping default import sorting from running in vs code (#17) --- .github/workflows/check-python.yaml | 2 ++ .../settings.json.jinja | 3 ++- tests/test_default_parameters/.copier-answers.yml | 12 ++++++------ tests/test_default_parameters/.vscode/settings.json | 3 ++- tests/test_templates.py | 8 ++++++++ 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check-python.yaml b/.github/workflows/check-python.yaml index 0f5e259d..b4b28b2c 100644 --- a/.github/workflows/check-python.yaml +++ b/.github/workflows/check-python.yaml @@ -39,4 +39,6 @@ jobs: shell: bash run: | set -o pipefail + # set git user and email as test invoke git + git config --global user.email "actions@github.com" && git config --global user.name "github-actions" poetry run pytest --junitxml=pytest-junit.xml diff --git a/template_content/{% if ide_vscode %}.vscode{% endif %}/settings.json.jinja b/template_content/{% if ide_vscode %}.vscode{% endif %}/settings.json.jinja index e61db1f3..dd521c8c 100644 --- a/template_content/{% if ide_vscode %}.vscode{% endif %}/settings.json.jinja +++ b/template_content/{% if ide_vscode %}.vscode{% endif %}/settings.json.jinja @@ -21,7 +21,8 @@ "[python]": { "editor.codeActionsOnSave": { "source.fixAll": true, - "source.organizeImports": true + // Prevent default import sorting from running; Ruff will sort imports for us anyway + "source.organizeImports": false }, "editor.defaultFormatter": null }, diff --git a/tests/test_default_parameters/.copier-answers.yml b/tests/test_default_parameters/.copier-answers.yml index b0057f0a..29f6094a 100644 --- a/tests/test_default_parameters/.copier-answers.yml +++ b/tests/test_default_parameters/.copier-answers.yml @@ -1,14 +1,14 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 1.1.3-8-g1163e6f -_src_path: /Users/adam/vcs/algokit-beaker-default-template -algod_port: '4001' +_commit: 1.1.4-4-g61a6075 +_src_path: /Users/danielm/repos/algorand/algokit-beaker-default-template +algod_port: 4001 algod_server: http://localhost algod_token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -author_email: null -author_name: null +author_email: None +author_name: None deployment_language: python ide_vscode: true -indexer_port: '8980' +indexer_port: 8980 indexer_server: http://localhost indexer_token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa project_name: test_default_parameters diff --git a/tests/test_default_parameters/.vscode/settings.json b/tests/test_default_parameters/.vscode/settings.json index 2c6078c3..411a4e10 100644 --- a/tests/test_default_parameters/.vscode/settings.json +++ b/tests/test_default_parameters/.vscode/settings.json @@ -18,7 +18,8 @@ "[python]": { "editor.codeActionsOnSave": { "source.fixAll": true, - "source.organizeImports": true + // Prevent default import sorting from running; Ruff will sort imports for us anyway + "source.organizeImports": false }, "editor.defaultFormatter": null }, diff --git a/tests/test_templates.py b/tests/test_templates.py index d0cff356..bed052c4 100644 --- a/tests/test_templates.py +++ b/tests/test_templates.py @@ -8,6 +8,7 @@ def run_init( *args: str, template_url: str | None = None, template_branch: str | None = None, + answers: dict[str, str] | None = None, ) -> subprocess.CompletedProcess: tests_path = Path(__file__).parent root = tests_path.parent @@ -37,6 +38,13 @@ def run_init( "--no-git", "--no-bootstrap", ] + if answers is None: + answers = { + "author_name": "None", + "author_email": "None", + } + for question, answer in answers.items(): + init_args.extend(["-a", question, answer]) if template_branch: init_args.extend(["--template-url-ref", template_branch]) init_args.extend(args)