test: reinstall pytest.ini / label test sets

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 <nbehrnd@yahoo.com>
This commit is contained in:
Norwid Behrnd 2024-11-05 22:04:21 +01:00
parent a3cd2a441e
commit 39364a6aef
3 changed files with 15 additions and 4 deletions

5
pytest.ini Normal file
View file

@ -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

View file

@ -73,6 +73,7 @@ arg3_values = [
# create the permutations: # create the permutations:
test_cases = list(product(arg1_values, arg2_values, arg3_values)) test_cases = list(product(arg1_values, arg2_values, arg3_values))
@pytest.mark.default
@pytest.mark.parametrize("arg1, arg2, arg3", test_cases) @pytest.mark.parametrize("arg1, arg2, arg3", test_cases)
def test_append(arg1, arg2, arg3): def test_append(arg1, arg2, arg3):
"""Test default which appends a string just prior file extension """Test default which appends a string just prior file extension
@ -139,6 +140,7 @@ arg4_values = [
# create the permutations: # create the permutations:
test_cases = list(product(arg1_values, arg2_values, arg3_values, arg4_values)) test_cases = list(product(arg1_values, arg2_values, arg3_values, arg4_values))
@pytest.mark.prepend
@pytest.mark.parametrize("arg1, arg2, arg3, arg4", test_cases) @pytest.mark.parametrize("arg1, arg2, arg3, arg4", test_cases)
def test_prepend(arg1, arg2, arg3, arg4): def test_prepend(arg1, arg2, arg3, arg4):
"""test to prepend a string to the original file name """test to prepend a string to the original file name
@ -209,6 +211,7 @@ arg3_values = [
# create the permutations: # create the permutations:
test_cases = list(product(arg1_values, arg2_values, arg3_values)) test_cases = list(product(arg1_values, arg2_values, arg3_values))
@pytest.mark.smart
@pytest.mark.parametrize("arg1, arg2, arg3", test_cases) @pytest.mark.parametrize("arg1, arg2, arg3", test_cases)
def test_smart_prepend(arg1, arg2, arg3): def test_smart_prepend(arg1, arg2, arg3):
"""test the insertion of a new string just past the time stamp """test the insertion of a new string just past the time stamp

View file

@ -156,12 +156,12 @@ pytest-3 test_appendfilename.py -v -m "default"
pytest-3 test_appendfilename.py -m "default and prepend" -v pytest-3 test_appendfilename.py -m "default and prepend" -v
#+end_src #+end_src
#+begin_src python :tangle no #+begin_src python :tangle pytest.ini
[pytest] [pytest]
Markers = Markers =
default: check the default insertion position of appendfile default: appendfilename's default string insertions
prepend: check the prepend insertion position of appendfile prepend: appendfilename's optional -p/--prepend flag
smart: check the smart-prepend insertion position of appendfile smart: appendfilename's optional --smart-prepend flag
#+end_src #+end_src
@ -253,6 +253,7 @@ arg3_values = [
# create the permutations: # create the permutations:
test_cases = list(product(arg1_values, arg2_values, arg3_values)) test_cases = list(product(arg1_values, arg2_values, arg3_values))
@pytest.mark.default
@pytest.mark.parametrize("arg1, arg2, arg3", test_cases) @pytest.mark.parametrize("arg1, arg2, arg3", test_cases)
def test_append(arg1, arg2, arg3): def test_append(arg1, arg2, arg3):
"""Test default which appends a string just prior file extension """Test default which appends a string just prior file extension
@ -328,6 +329,7 @@ arg4_values = [
# create the permutations: # create the permutations:
test_cases = list(product(arg1_values, arg2_values, arg3_values, arg4_values)) test_cases = list(product(arg1_values, arg2_values, arg3_values, arg4_values))
@pytest.mark.prepend
@pytest.mark.parametrize("arg1, arg2, arg3, arg4", test_cases) @pytest.mark.parametrize("arg1, arg2, arg3, arg4", test_cases)
def test_prepend(arg1, arg2, arg3, arg4): def test_prepend(arg1, arg2, arg3, arg4):
"""test to prepend a string to the original file name """test to prepend a string to the original file name
@ -413,6 +415,7 @@ arg3_values = [
# create the permutations: # create the permutations:
test_cases = list(product(arg1_values, arg2_values, arg3_values)) test_cases = list(product(arg1_values, arg2_values, arg3_values))
@pytest.mark.smart
@pytest.mark.parametrize("arg1, arg2, arg3", test_cases) @pytest.mark.parametrize("arg1, arg2, arg3", test_cases)
def test_smart_prepend(arg1, arg2, arg3): def test_smart_prepend(arg1, arg2, arg3):
"""test the insertion of a new string just past the time stamp """test the insertion of a new string just past the time stamp