Skip to content

Move codemod tests into tests/integration #76

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

Merged
merged 4 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ commands:
steps:
- restore_cache:
keys:
- v1-verified-codemod-repos-{{ checksum "tests/verified_codemods/codemod_data/repo_commits.json" }}-{{.Environment.CIRCLE_NODE_INDEX}}-{{.Environment.CIRCLE_NODE_TOTAL}}
- v1-verified-codemod-repos-{{ checksum "tests/integration/verified_codemods/codemod_data/repo_commits.json" }}-{{.Environment.CIRCLE_NODE_INDEX}}-{{.Environment.CIRCLE_NODE_TOTAL}}
- run:
command: |
uv run --frozen gs codemod clone-repos --verified-codemod-repos --token ${CODEGEN_BOT_GHE_TOKEN}
- save_cache:
paths:
- $GITHUB_WORKSPACE
key: v1-verified-codemod-repos-{{ checksum "tests/verified_codemods/codemod_data/repo_commits.json" }}-{{.Environment.CIRCLE_NODE_INDEX}}-{{.Environment.CIRCLE_NODE_TOTAL}}
key: v1-verified-codemod-repos-{{ checksum "tests/integration/verified_codemods/codemod_data/repo_commits.json" }}-{{.Environment.CIRCLE_NODE_INDEX}}-{{.Environment.CIRCLE_NODE_TOTAL}}
build-wheels:
parameters:
base_packages:
Expand Down Expand Up @@ -237,7 +237,7 @@ jobs:
- fetch-verified-codemods
- cache-verified-codemod-repos
- run_ats:
default_tests: "tests/codemod/test_verified_codemods.py"
default_tests: "tests/integration/codemod/test_verified_codemods.py"
codecov_flags: "smart-tests-codemod"
collect_args: --cli-api-key ${PROD_CLI_API_KEY} --token ${CODEGEN_BOT_GHE_TOKEN}
ats_collect_args: --cli-api-key=${PROD_CLI_API_KEY},--token=${CODEGEN_BOT_GHE_TOKEN},
Expand All @@ -264,7 +264,7 @@ jobs:
- clone-repos:
extra_repos: false
- run_ats:
default_tests: "tests/codemod/test_codemods.py"
default_tests: "tests/integration/codemod/test_codemods.py"
codecov_flags: "smart-tests-codemod-oss"
collect_args: --size=<<parameters.size>> --sync-graph=<<parameters.sync_graph>> --token ${CODEGEN_BOT_GHE_TOKEN}
ats_collect_args: --size=<<parameters.size>>,--sync-graph=<<parameters.sync_graph>>,--token=${CODEGEN_BOT_GHE_TOKEN},
Expand Down Expand Up @@ -297,7 +297,7 @@ jobs:
if [ "<<parameters.extra_repos>>" = "true" ]; then
EXTRA_REPOS_ARG="--extra-repos=true"
fi
PYTEST_ARGS="${EXTRA_REPOS_ARG} --token ${CODEGEN_BOT_GHE_TOKEN} -o junit_suite_name=\"${CIRCLE_JOB}\" tests/codemod/test_parse.py"
PYTEST_ARGS="${EXTRA_REPOS_ARG} --token ${CODEGEN_BOT_GHE_TOKEN} -o junit_suite_name=\"${CIRCLE_JOB}\" tests/integration/codemod/test_parse.py"
echo "Running tests with args: $PYTEST_ARGS"
TESTS_TO_RUN=$(PYTEST_ARGS=${PYTEST_ARGS} ./.circleci/collect.sh)
echo $TESTS_TO_RUN | circleci tests run --command "ulimit -s unlimited; xargs uv run --frozen pytest -n auto ${PYTEST_ARGS}"
Expand Down
6 changes: 3 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**/expected_diff.txt filter=lfs diff=lfs merge=lfs -text
tests/codemod/repos/extra/*.json filter=lfs diff=lfs merge=lfs -text
tests/integration/codemod/repos/extra/*.json filter=lfs diff=lfs merge=lfs -text
**/expected_diff.patch filter=lfs diff=lfs merge=lfs -text
tests/codemod/repos/repos.json filter=lfs diff=lfs merge=lfs -text
tests/verified_codemods/** filter=lfs diff=lfs merge=lfs -text
tests/integration/codemod/repos/repos.json filter=lfs diff=lfs merge=lfs -text
tests/integration/verified_codemods/** filter=lfs diff=lfs merge=lfs -text
.github/disallowed-words.txt filter=lfs diff=lfs merge=lfs -text
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ uv-*.tar.gz
graph-sitter-types/out/**
graph-sitter-types/typings/**
coverage.json
tests/verified_codemods/codemod_data/repo_commits.json
tests/integration/verified_codemods/codemod_data/repo_commits.json

2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/[email protected]"]
exclude: (src/codemods/eval)|(tests/unit/skills)|(tests/unit/output)|(tests/verified_codemods)|(docs/samples)
exclude: (src/codemods/eval)|(tests/unit/codegen/sdk/skills)|(tests/unit/codegen/sdk/output)|(tests/integration/verified_codemods)|(docs/samples)

- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.16.6
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ uv sync --dev
uv run pytest tests/unit -n auto

# Codemod tests (tests larger programs)
uv run pytest tests/codemod/test_codemods.py -n auto
uv run pytest tests/integration/codemod/test_codemods.py -n auto
```

## Pull Request Process
Expand Down
4 changes: 2 additions & 2 deletions src/codegen/sdk/testing/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

BASE_TMP_DIR = Path(os.getenv("GITHUB_WORKSPACE", tempfile.gettempdir()))
BASE_PATH: Path = Path(__file__).parent.parent.parent.parent.parent
TEST_DIR: Path = BASE_PATH / "tests" / "codemod"
TEST_DIR: Path = BASE_PATH / "tests" / "integration" / "codemod"
CODEMOD_PATH: Path = BASE_PATH / "src" / "codemods"
VERIFIED_CODEMOD_DIR: Path = BASE_PATH / "tests" / "verified_codemods"
VERIFIED_CODEMOD_DIR: Path = BASE_PATH / "tests" / "integration" / "verified_codemods"
VERIFIED_CODEMOD_DATA_DIR: Path = VERIFIED_CODEMOD_DIR / "codemod_data"
VERIFIED_CODEMOD_DIFFS: Path = VERIFIED_CODEMOD_DIR / "verified_codemod_diffs"

Expand Down
2 changes: 1 addition & 1 deletion src/codemods/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Put your codemod in the canonical folder if it is canonical, otherwise put it in misc.
You can also add company folders if you wish
`{codemod_folder} = src/codemods/{type}/{name}`
`{codemod_tests_folder} = tests/codemod/{type}/{name}`
`{codemod_tests_folder} = tests/integration/codemod/{type}/{name}`

## Repos

Expand Down
1 change: 0 additions & 1 deletion tests/README.md

This file was deleted.

Empty file removed tests/codemod/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions tests/shared/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Tests/shared

### What kind of things should go in here?
Testing utilities like mocks, fixtures, test data that are used across multiple tests.