Skip to content

Commit

Permalink
Merge pull request #22 from nbehrnd/master
Browse files Browse the repository at this point in the history
extend rebuild of pytest to prepend and smart-prepend mode
  • Loading branch information
nbehrnd authored Nov 5, 2024
2 parents 140671f + 297ee62 commit 2b13f3b
Show file tree
Hide file tree
Showing 5 changed files with 634 additions and 290 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
jobs:
test-ubuntu-2404:
runs-on: ubuntu-24.04
timeout-minutes: 2
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
Expand All @@ -34,11 +34,14 @@ jobs:
run: pip install -r requirements.txt

- name: run the check by pytest
run: python -m pytest
run: |
python -m pytest -m "default"
python -m pytest -m "prepend"
python -m pytest -m "smart"
test-windows-2022:
runs-on: windows-2022
timeout-minutes: 2
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
Expand All @@ -53,11 +56,15 @@ jobs:
run: pip install -r requirements.txt

- name: run the check by pytest
run: python -m pytest
run: |
python -m pytest -m "default"
python -m pytest -m "prepend"
python -m pytest -m "smart"
test-macos-14:
runs-on: macos-14
timeout-minutes: 2
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
Expand All @@ -72,4 +79,8 @@ jobs:
run: pip install -r requirements.txt

- name: run the check by pytest
run: python -m pytest
run: |
python -m pytest -m "default"
python -m pytest -m "prepend"
python -m pytest -m "smart"
6 changes: 3 additions & 3 deletions appendfilename/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
BETWEEN_TAG_SEPARATOR = ' ' # between tags (not that relevant in this tool)
DEFAULT_TEXT_SEPARATOR = ' ' # between old file name and inserted text
RENAME_SYMLINK_ORIGINALS_WHEN_RENAMING_SYMLINKS = True # if current file is a symlink with the same name, also rename source file
WITHTIME_AND_SECONDS_PATTERN = re.compile('^(\d{4,4}-[01]\d-[0123]\d(([T :_-])([012]\d)([:.-])([012345]\d)(([:.-])([012345]\d))?)?)[- _.](.+)')
WITHTIME_AND_SECONDS_PATTERN = re.compile(r"^(\d{4,4}-[01]\d-[0123]\d(([T :_-])([012]\d)([:.-])([012345]\d)(([:.-])([012345]\d))?)?)[- _.](.+)")

USAGE = "\n\
appendfilename [<options>] <list of files>\n\
Expand Down Expand Up @@ -60,13 +60,13 @@


# file names containing optional tags matches following regular expression
FILE_WITH_EXTENSION_REGEX = re.compile("(.*?)(( -- .*)?(\.\w+?)?)$")
FILE_WITH_EXTENSION_REGEX = re.compile(r"(.*?)(( -- .*)?(\.\w+?)?)$")
FILE_WITH_EXTENSION_BASENAME_INDEX = 1
FILE_WITH_EXTENSION_TAGS_AND_EXT_INDEX = 2


# RegEx which defines "what is a file name component" for tab completion:
FILENAME_COMPONENT_REGEX = re.compile("[a-zA-Z]+")
FILENAME_COMPONENT_REGEX = re.compile(r"[a-zA-Z]+")

# blacklist of lowercase strings that are being ignored for tab completion
FILENAME_COMPONENT_LOWERCASE_BLACKLIST = ['img', 'eine', 'einem', 'eines', 'fuer', 'haben',
Expand Down
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
Markers =
default: appendfilename's default string insertions
prepend: appendfilename's optional -p/--prepend flag
smart: appendfilename's optional --smart-prepend flag
Loading

0 comments on commit 2b13f3b

Please sign in to comment.