diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 29be111..4f50403 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -19,24 +19,21 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" - name: Set up Python package run: | - python -m pip install --upgrade pip - python -m pip install .[test] + python3 -m pip install --upgrade pip + python3 -m pip install .[test] - name: Run regression tests run: | + set enable-bracketed-paste off pytest - name: Check module imports with isort run: | - python -m pip install isort - python -m isort . --check-only --diff + python3 -m pip install isort + python3 -m isort . --check-only --diff # uses: isort/isort-action@master - name: Check formatting with black @@ -44,6 +41,6 @@ jobs: - name: Check building a binary wheel and a source tarball run: | - python -m pip install twine build --user - python -m build --sdist --wheel --outdir dist/ . - python -m twine check dist/* + python3 -m pip install twine build --user + python3 -m build --sdist --wheel --outdir dist/ . + python3 -m twine check dist/* diff --git a/examples/backward_search.sh b/examples/backward_search.sh index ab2c0d5..1ddef94 100644 --- a/examples/backward_search.sh +++ b/examples/backward_search.sh @@ -14,7 +14,7 @@ rm my_first_file.txt #$ delay 500 #$ send touch -#$ expect second +#$ expect second_file.txt #$ wait 1000 diff --git a/examples/history.sh b/examples/history.sh index 9726972..65d5548 100644 --- a/examples/history.sh +++ b/examples/history.sh @@ -11,7 +11,10 @@ rm my_first_file.txt #$ delay 800 -#$ sendarrow up 2 +#$ sendarrow up 1 +#$ expect rm my_first_file.txt + +#$ sendarrow up 1 #$ expect touch my_second_file.txt #$ sendarrow up diff --git a/examples/special_character.sh b/examples/special_character.sh index af03fce..1998311 100644 --- a/examples/special_character.sh +++ b/examples/special_character.sh @@ -1,2 +1,4 @@ + +#$ expect \$ #$ sendcharacter # This is a test with URL (https://github.com) diff --git a/tests/custom_rc_file_dumb_term b/tests/custom_rc_file_dumb_term new file mode 100644 index 0000000..64acedd --- /dev/null +++ b/tests/custom_rc_file_dumb_term @@ -0,0 +1,5 @@ +export PS1="$ " +export HOME=~ +export TERM=dumb +export PATH=/usr/bin:/usr/local/bin/ +set enable-bracketed-paste off diff --git a/tests/custom_rc_file_xterm_term b/tests/custom_rc_file_xterm_term new file mode 100644 index 0000000..f8aefad --- /dev/null +++ b/tests/custom_rc_file_xterm_term @@ -0,0 +1,5 @@ +export PS1="$ " +export HOME=~ +export TERM=xterm +export PATH=/usr/bin:/usr/local/bin/ +set enable-bracketed-paste off diff --git a/tests/reference_output/asciinema_hello_world.cast b/tests/reference_output/asciinema_hello_world.cast index 490833f..ad04f21 100644 --- a/tests/reference_output/asciinema_hello_world.cast +++ b/tests/reference_output/asciinema_hello_world.cast @@ -1,13 +1,12 @@ -[?2004h$ asciinema rec temp_test.cast \ -[?2004l [?2004h> --overwrite \ -[?2004l [?2004h> -c 'env -i PS1=$ bash --noprofile --norc' \ -[?2004l [?2004h> -q -[?2004l $echo "Hello World" +$ asciinema rec temp_test.cast \ +> --overwrite \ +> -c 'env -i PS1=$ bash --noprofile --norc' \ +> -q +$echo "Hello World" Hello World $exit -[?2004h$ asciinema play temp_test.cast -[?2004l $echo "Hello World" +$ asciinema play temp_test.cast +$echo "Hello World" Hello World $exit -[?2004h$ [?2004l -exit +$ exit diff --git a/tests/reference_output/autocompletion.cast b/tests/reference_output/autocompletion.cast index 521fa06..32fe227 100644 --- a/tests/reference_output/autocompletion.cast +++ b/tests/reference_output/autocompletion.cast @@ -1,6 +1,5 @@ -[?2004h$ mkdir my_folder_with_a_very_long_name -[?2004l [?2004h$ cd my_folder_with_a_very_long_name/ -[?2004l [?2004h$ basename $PWD -[?2004l my_folder_with_a_very_long_name -[?2004h$ [?2004l -exit +$ mkdir my_folder_with_a_very_long_name +$ cd my_folder_with_a_very_long_name/ +$ basename $PWD +my_folder_with_a_very_long_name +$ exit diff --git a/tests/reference_output/backward_search.cast b/tests/reference_output/backward_search.cast index 71ddeee..1feeb67 100644 --- a/tests/reference_output/backward_search.cast +++ b/tests/reference_output/backward_search.cast @@ -1,8 +1,11 @@ -[?2004h$ touch my_first_file.txt -[?2004l [?2004h$ touch my_second_file.txt -[?2004l [?2004h$ rm my_first_file.txt -[?2004l [?2004h$ (reverse-i-search)`': t': rm my_first_file.txt (reverse-i-search)`to': touch my_second_file.txt[1@u': tou[1@c': touc[1@h': touchtouch my_first $ touch $ -[?2004l [?2004h$ ls my_first_file.txt -[?2004l my_first_file.txt -[?2004h$ [?2004l -exit +$ touch my_first_file.txt +$ touch my_second_file.txt +$ rm my_first_file.txt +$ +(reverse-i-search)`': t': rm my_first_file.txt +(reverse-i-search)`to': touch my_second_file.txt[1@u': tou[1@c': touc[1@h': touchtouch my_first +$ touch +$ +$ ls my_first_file.txt +my_first_file.txt +$ exit diff --git a/tests/reference_output/change_structure.cast b/tests/reference_output/change_structure.cast index a497b04..75aa002 100644 --- a/tests/reference_output/change_structure.cast +++ b/tests/reference_output/change_structure.cast @@ -1,14 +1,13 @@ -[?2004h$ mkdir my_directory -[?2004l [?2004h$ cd my_directory -[?2004l [?2004h$ basename $PWD -[?2004l my_directory -[?2004h$ touch my_textfile.txt -[?2004l [?2004h$ ls -[?2004l my_textfile.txt -[?2004h$ rm my_textfile.txt -[?2004l [?2004h$ ls -[?2004l [?2004h$ cd .. -[?2004l [?2004h$ rm -r my_directory -[?2004l [?2004h$ ls -[?2004l [?2004h$ [?2004l -exit +$ mkdir my_directory +$ cd my_directory +$ basename $PWD +my_directory +$ touch my_textfile.txt +$ ls +my_textfile.txt +$ rm my_textfile.txt +$ ls +$ cd .. +$ rm -r my_directory +$ ls +$ exit diff --git a/tests/reference_output/escaped_command.cast b/tests/reference_output/escaped_command.cast index fd448aa..4af781a 100644 --- a/tests/reference_output/escaped_command.cast +++ b/tests/reference_output/escaped_command.cast @@ -1,6 +1,5 @@ -[?2004h$ echo "Very" \ -[?2004l [?2004h> "long" \ -[?2004l [?2004h> "command" -[?2004l Very long command -[?2004h$ [?2004l -exit +$ echo "Very" \ +> "long" \ +> "command" +Very long command +$ exit diff --git a/tests/reference_output/hello_world.cast b/tests/reference_output/hello_world.cast index 65c2de4..0e4fb7d 100644 --- a/tests/reference_output/hello_world.cast +++ b/tests/reference_output/hello_world.cast @@ -1,8 +1,7 @@ -[?2004h$ echo "Hello world" -[?2004l Hello world -[?2004h$ echo "I have waited 1000ms" -[?2004l I have waited 1000ms -[?2004h$ echo "I am writing with a 10ms delay" -[?2004l I am writing with a 10ms delay -[?2004h$ [?2004l -exit +$ echo "Hello world" +Hello world +$ echo "I have waited 1000ms" +I have waited 1000ms +$ echo "I am writing with a 10ms delay" +I am writing with a 10ms delay +$ exit diff --git a/tests/reference_output/history.cast b/tests/reference_output/history.cast index 8e198a1..daec0fe 100644 --- a/tests/reference_output/history.cast +++ b/tests/reference_output/history.cast @@ -1,8 +1,9 @@ -[?2004h$ touch my_first_file.txt -[?2004l [?2004h$ touch my_second_file.txt -[?2004l [?2004h$ rm my_first_file.txt -[?2004l [?2004h$ rm my_first_file.txt $ [4@touch my_second_file.txt $ touch my_first_file.txt -[?2004l [?2004h$ ls -[?2004l my_first_file.txt my_second_file.txt -[?2004h$ [?2004l -exit +$ touch my_first_file.txt +$ touch my_second_file.txt +$ rm my_first_file.txt +$ rm my_first_file.txt +$ [4@touch my_second_file.txt +$ touch my_first_file.txt +$ ls +my_first_file.txt my_second_file.txt +$ exit diff --git a/tests/reference_output/man_page.cast b/tests/reference_output/man_page.cast index 71051f9..530e1fd 100644 --- a/tests/reference_output/man_page.cast +++ b/tests/reference_output/man_page.cast @@ -1,5 +1,6 @@ -[?2004h$ man echo -[?2004l [?1049h[?1h= ECHO(1) User Commands ECHO(1) +$ man echo +[?1049h[?1h= +ECHO(1) User Commands ECHO(1)  NAME echo - display a line of text @@ -22,10 +23,25 @@ --version output version information and exit  - Manual page echo(1) line 1 (press h for help or q to quit)  ESCESC[[BB  Manual page echo(1) line 1 (press h for help or q to quit)  If -e is in effect, the following sequences are recognized: - Manual page echo(1) line 2 (press h for help or q to quit)  ESCESC[[BB  Manual page echo(1) line 2 (press h for help or q to quit)  - Manual page echo(1) line 3 (press h for help or q to quit)  ESCESC[[BB  Manual page echo(1) line 3 (press h for help or q to quit)  \\ backslash - Manual page echo(1) line 4 (press h for help or q to quit)  ESCESC[[BB  Manual page echo(1) line 4 (press h for help or q to quit)  - Manual page echo(1) line 5 (press h for help or q to quit)  ESCESC[[BB  Manual page echo(1) line 5 (press h for help or q to quit)  \a alert (BEL) - Manual page echo(1) line 6 (press h for help or q to quit) [?1l>[?1049l[?2004h$ [?2004l -exit + Manual page echo(1) line 1 (press h for help or q to quit) + ESCESC[[BB + Manual page echo(1) line 1 (press h for help or q to quit) + If -e is in effect, the following sequences are recognized: + Manual page echo(1) line 2 (press h for help or q to quit) + ESCESC[[BB + Manual page echo(1) line 2 (press h for help or q to quit) + + Manual page echo(1) line 3 (press h for help or q to quit) + ESCESC[[BB + Manual page echo(1) line 3 (press h for help or q to quit) + \\ backslash + Manual page echo(1) line 4 (press h for help or q to quit) + ESCESC[[BB + Manual page echo(1) line 4 (press h for help or q to quit) + + Manual page echo(1) line 5 (press h for help or q to quit) + ESCESC[[BB + Manual page echo(1) line 5 (press h for help or q to quit) + \a alert (BEL) + Manual page echo(1) line 6 (press h for help or q to quit) +[?1l>[?1049l$ exit diff --git a/tests/reference_output/special_character.cast b/tests/reference_output/special_character.cast index e45483e..7215b6b 100644 --- a/tests/reference_output/special_character.cast +++ b/tests/reference_output/special_character.cast @@ -1,3 +1,2 @@ -[?2004h$ #This is a test with URL (https://github.com) -[?2004l [?2004h$ [?2004l -exit +$ #This is a test with URL (https://github.com) +$ exit diff --git a/tests/test_regression.py b/tests/test_regression.py index 7fe0aa3..c9079a4 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -28,14 +28,24 @@ def test_regression(tmp_path, request, inputfile: pathlib.Path): reference_folder = ( request.config.invocation_params.dir / "tests" / "reference_output" ) + custom_rc_file = ( + request.config.invocation_params.dir / "tests" / "custom_rc_file_dumb_term" + ) output_folder = tmp_path output_file_name = inputfile.stem + ".cast" print(pathlib.Path().cwd()) + term: str = "dumb" + if inputfile.name in ["backward_search.sh", "history.sh", "man_page.sh"]: + custom_rc_file = ( + request.config.invocation_params.dir / "tests" / "custom_rc_file_xterm_term" + ) cli( [ "--debug", "--asciinema-arguments", - """--raw --overwrite -c 'env -i TERM=xterm-256color HOME=~ PS1="$ " PATH=/usr/bin:/usr/local/bin/ bash --noprofile --norc'""", + """--raw --overwrite -c 'env -i bash --noprofile --rcfile """ + + str(custom_rc_file) + + """'""", str(example_folder / inputfile.name), str(output_folder / output_file_name), ]