Skip to content
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

extend rebuild of pytest to prepend and smart-prepend mode #22

Merged
merged 11 commits into from
Nov 5, 2024

Conversation

nbehrnd
Copy link
Collaborator

@nbehrnd nbehrnd commented Nov 5, 2024

Pytest tests now cover again default, prepend, and smart-prepend mode of appendfilename.

The format of the smart-prepend mode depends on the format of the format of the input file submitted. At present, the robustness of processing the separator between the string-to-be-added and the original file name depends on the operating system (Linux Debian better, than Windows). Nevertheless, the commit provides the tests (in place, only muted) to assist a refactoring of appendfilename in future.

The checks about appendfilename's default, i.e. to insert a string
just prior to the file extension were edited.  This aims to provide
better portability of the tests when launching pytest either in
Linux Debian 13/trixie, or Windows 10.

Signed-off-by: Norwid Behrnd <[email protected]>
Documentation about the first set of tests (default append of a string
to the file's file name) was updated.

Signed-off-by: Norwid Behrnd <[email protected]>
In similar pattern to the first section (append a string), the
tests of the second section (to prepend a string to the orginal
file name) are revised for better portability on different
operating systems.

Signed-off-by: Norwid Behrnd <[email protected]>
Documentation about the second set of tests (prepend a string to
the original file name of a file) was updated.

Signed-off-by: Norwid Behrnd <[email protected]>
The third section of tests about smartly prepending a string -- i.e.
to insert a string right after the time or date stamp -- was edited.
Manual tests in Linux Debian and Windows 10 as well as with pytest
on either operating system confirm inconsistencies of the format
of the file name eventually generated.[1,2]

In addition, the implementation differs in robustness to deploy
special characters like for instance the underscore as a separator
to enclose the string to add.  Instead of `_` (as in Debian), Windows
tends to enclose these separators with single quotes (`'_'`) instead.
The default by `appendfilename` to use a single blank character
still is considered "safe to be used" _for `appendfilename`_ though
e.g. the underscore would represent a safe alternative if file names
with white space are not acceptable.

[1] novoid#15
[2] novoid#16

Signed-off-by: Norwid Behrnd <[email protected]>
Previously present labels to check appendfilename's work in either
default, prepend, or smart prepend pattern as well as file
pytest.ini are reinstalled again.

Signed-off-by: Norwid Behrnd <[email protected]>
With pytest labels installed (default, prepend, smart) it will be
easier to recognize which sub set contains a failing test.

Signed-off-by: Norwid Behrnd <[email protected]>
The second and third section of the pytest tests were rewritten
to be more portable for either Linux Debian 13, or Windows 10.

As confirmed during this revision, the outcome of the optional
--smart-prepend mode still depends on the format of the leading
time stamp.

Second, special characters presumed to provide a file name without
a white space (for instance the underscore), though working well in
Linux Debian, are not reliably processed in Windows.  To facilitate
a subsequent refactoring of appendfilename, the corresponding tests
already are present, however currently muted.

Thirdly, the reinstallment of pytest.ini and labels allows again
to address the pytest tests by the name of their set: default,
prepend, and smart.

Signed-off-by: Norwid Behrnd <[email protected]>
@nbehrnd nbehrnd merged commit 2b13f3b into novoid:master Nov 5, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant