Skip to content

Commit

Permalink
Fix up tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlevy committed Nov 27, 2024
1 parent 61b9601 commit ef72fe8
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 39 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand All @@ -25,7 +28,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
Expand All @@ -38,7 +41,7 @@ jobs:
path: |
~/.cache/pypoetry
~/.cache/pip
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-poetry-
Expand Down
1 change: 1 addition & 0 deletions repren/repren.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ def rewrite_files(
dry_run: bool = False,
) -> None:
paths = walk_files(root_paths, exclude_pat=exclude_pat)
paths.sort() # Ensure deterministic order of file processing.
log(None, "Found %s files in: %s" % (len(paths), ", ".join(root_paths)))
for path in paths:
rewrite_file(
Expand Down
3 changes: 3 additions & 0 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ cp -a $dir/work-dir $dir/tmp-dir
cd $dir/tmp-dir

echo "Running..."
echo "Platform and Python version:"
uname
python -V

# Hackity hack:
# Remove per-run and per-platform details to allow easy comparison.
Expand Down
Empty file removed tests/test.diff
Empty file.
59 changes: 27 additions & 32 deletions tests/tests-clean.log
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@

# --- Start of tests ---

# Platform and Python version we're using to run tests.
uname
Darwin

python -V
Python 3.12.7

run || expect_error
usage: repren.py [-h] [--version] [--from FROM_PAT] [--to TO_PAT]
Expand Down Expand Up @@ -161,9 +156,9 @@ Using 5 patterns:
'Asia' -> 'Asia!'
'Europe' -> 'Europe!'
Found 12 files in: test4
- modify: test4/stuff/trees/beech.txt: 8 matches
- modify: test4/stuff/trees/maple.txt: 3 matches
- modify: test4/stuff/trees/oak.txt: 3 matches
- modify: test4/stuff/trees/beech.txt: 8 matches
Read 12 files (3810 chars), found 14 matches (0 skipped due to overlaps)
Changed 3 files (3 rewritten and 0 renamed)

Expand Down Expand Up @@ -205,12 +200,12 @@ Using 5 patterns:
Found 12 files in: test5
- modify: test5/humpty-dumpty.txt: 6 matches
- rename: test5/humpty-dumpty.txt -> test5/dumpty-humpty.txt
- rename: test5/stuff/words/Asia -> test5/stuff/words/Asia!
- rename: test5/stuff/words/Europe -> test5/stuff/words/Europe!
- modify: test5/stuff/trees/maple.txt: 3 matches
- modify: test5/stuff/trees/oak.txt: 3 matches
- modify: test5/stuff/trees/beech.txt: 10 matches
- rename: test5/stuff/trees/beech.txt -> test5/stuff/trees/BEECH.txt
- modify: test5/stuff/trees/maple.txt: 3 matches
- modify: test5/stuff/trees/oak.txt: 3 matches
- rename: test5/stuff/words/Asia -> test5/stuff/words/Asia!
- rename: test5/stuff/words/Europe -> test5/stuff/words/Europe!
Read 12 files (3810 chars), found 22 matches (0 skipped due to overlaps)
Changed 6 files (4 rewritten and 4 renamed)

Expand Down Expand Up @@ -291,17 +286,17 @@ Using 6 patterns:
'c' -> 'a'
Found 12 files in: test7
- modify: test7/humpty-dumpty.txt: 40 matches
- rename: test7/stuff/words/oak -> test7/stuff/words/obk
- rename: test7/stuff/words/genetic -> test7/stuff/words/genetia
- rename: test7/stuff/words/second -> test7/stuff/words/seaond
- rename: test7/stuff/words/Asia -> test7/stuff/words/Bsib
- rename: test7/stuff/words/Mexico -> test7/stuff/words/Mexiao
- modify: test7/stuff/trees/beech.txt: 180 matches
- rename: test7/stuff/trees/beech.txt -> test7/stuff/trees/ceeah.txt
- modify: test7/stuff/trees/maple.txt: 43 matches
- rename: test7/stuff/trees/maple.txt -> test7/stuff/trees/mbple.txt
- modify: test7/stuff/trees/oak.txt: 161 matches
- rename: test7/stuff/trees/oak.txt -> test7/stuff/trees/obk.txt
- modify: test7/stuff/trees/beech.txt: 180 matches
- rename: test7/stuff/trees/beech.txt -> test7/stuff/trees/ceeah.txt
- rename: test7/stuff/words/Asia -> test7/stuff/words/Bsib
- rename: test7/stuff/words/Mexico -> test7/stuff/words/Mexiao
- rename: test7/stuff/words/genetic -> test7/stuff/words/genetia
- rename: test7/stuff/words/oak -> test7/stuff/words/obk
- rename: test7/stuff/words/second -> test7/stuff/words/seaond
Read 12 files (3810 chars), found 424 matches (0 skipped due to overlaps)
Changed 9 files (4 rewritten and 8 renamed)

Expand All @@ -315,17 +310,17 @@ Using 6 patterns:
'c' -> 'a'
Found 12 files in: test7
- modify: test7/humpty-dumpty.txt: 40 matches
- rename: test7/stuff/words/obk -> test7/stuff/words/ock
- rename: test7/stuff/words/Bsib -> test7/stuff/words/Csic
- rename: test7/stuff/words/Mexiao -> test7/stuff/words/Mexibo
- rename: test7/stuff/words/seaond -> test7/stuff/words/sebond
- rename: test7/stuff/words/genetia -> test7/stuff/words/genetib
- modify: test7/stuff/trees/ceeah.txt: 180 matches
- rename: test7/stuff/trees/ceeah.txt -> test7/stuff/trees/aeebh.txt
- modify: test7/stuff/trees/obk.txt: 161 matches
- rename: test7/stuff/trees/obk.txt -> test7/stuff/trees/ock.txt
- modify: test7/stuff/trees/mbple.txt: 43 matches
- rename: test7/stuff/trees/mbple.txt -> test7/stuff/trees/mcple.txt
- modify: test7/stuff/trees/obk.txt: 161 matches
- rename: test7/stuff/trees/obk.txt -> test7/stuff/trees/ock.txt
- rename: test7/stuff/words/Bsib -> test7/stuff/words/Csic
- rename: test7/stuff/words/Mexiao -> test7/stuff/words/Mexibo
- rename: test7/stuff/words/genetia -> test7/stuff/words/genetib
- rename: test7/stuff/words/obk -> test7/stuff/words/ock
- rename: test7/stuff/words/seaond -> test7/stuff/words/sebond
Read 12 files (3810 chars), found 424 matches (0 skipped due to overlaps)
Changed 9 files (4 rewritten and 8 renamed)

Expand All @@ -339,17 +334,17 @@ Using 6 patterns:
'c' -> 'a'
Found 12 files in: test7
- modify: test7/humpty-dumpty.txt: 40 matches
- rename: test7/stuff/words/Csic -> test7/stuff/words/Asia
- rename: test7/stuff/words/genetib -> test7/stuff/words/genetic
- rename: test7/stuff/words/Mexibo -> test7/stuff/words/Mexico
- rename: test7/stuff/words/sebond -> test7/stuff/words/second
- rename: test7/stuff/words/ock -> test7/stuff/words/oak
- modify: test7/stuff/trees/ock.txt: 161 matches
- rename: test7/stuff/trees/ock.txt -> test7/stuff/trees/oak.txt
- modify: test7/stuff/trees/aeebh.txt: 180 matches
- rename: test7/stuff/trees/aeebh.txt -> test7/stuff/trees/beech.txt
- modify: test7/stuff/trees/mcple.txt: 43 matches
- rename: test7/stuff/trees/mcple.txt -> test7/stuff/trees/maple.txt
- modify: test7/stuff/trees/ock.txt: 161 matches
- rename: test7/stuff/trees/ock.txt -> test7/stuff/trees/oak.txt
- rename: test7/stuff/words/Csic -> test7/stuff/words/Asia
- rename: test7/stuff/words/Mexibo -> test7/stuff/words/Mexico
- rename: test7/stuff/words/genetib -> test7/stuff/words/genetic
- rename: test7/stuff/words/ock -> test7/stuff/words/oak
- rename: test7/stuff/words/sebond -> test7/stuff/words/second
Read 12 files (3810 chars), found 424 matches (0 skipped due to overlaps)
Changed 9 files (4 rewritten and 8 renamed)

Expand All @@ -369,9 +364,9 @@ Using 3 patterns:
'\bc\b' -> 'a'
Found 12 files in: test8
- modify: test8/humpty-dumpty.txt: 4 matches
- modify: test8/stuff/trees/beech.txt: 4 matches
- modify: test8/stuff/trees/maple.txt: 2 matches
- modify: test8/stuff/trees/oak.txt: 6 matches
- modify: test8/stuff/trees/beech.txt: 4 matches
Read 12 files (3810 chars), found 16 matches (0 skipped due to overlaps)
Changed 4 files (4 rewritten and 0 renamed)

Expand Down
5 changes: 0 additions & 5 deletions tests/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ set -v

# --- Start of tests ---

# Platform and Python version we're using to run tests.
uname

python -V

run || expect_error

# Text replacements, no renames.
Expand Down

0 comments on commit ef72fe8

Please sign in to comment.