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

Change standart to standard #10

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,28 @@ 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: |
pytest
set enable-bracketed-paste off
python3 -m 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
uses: psf/black@stable

- 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/*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ venv.bak/

# Others
.DS_Store

.vscode-server
8 changes: 4 additions & 4 deletions asciinema_automation/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ def cli(argv=None):
)
parser.add_argument(
"-sd",
"--standart-deviation",
"--standard-deviation",
type=int,
default=60,
help="standart deviation for gaussian used to generate time between key strokes",
help="standard deviation for gaussian used to generate time between key strokes",
)
parser.add_argument(
"-t",
Expand Down Expand Up @@ -70,7 +70,7 @@ def cli(argv=None):
delay = args.delay
wait = args.wait
asciinema_arguments = args.asciinema_arguments
standart_deviation = args.standart_deviation
standard_deviation = args.standard_deviation
loglevel = args.loglevel
timeout = args.timeout

Expand All @@ -87,7 +87,7 @@ def cli(argv=None):
asciinema_arguments,
wait,
delay,
standart_deviation,
standard_deviation,
timeout,
)

Expand Down
12 changes: 6 additions & 6 deletions asciinema_automation/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@ def run(self, script):
for send_character, receive_character in zip(
self.send_value, self.receive_value
):
if script.standart_deviation is None:
if script.standard_deviation is None:
time.sleep(script.delay)
else:
time.sleep(abs(random.gauss(script.delay, script.standart_deviation)))
time.sleep(abs(random.gauss(script.delay, script.standard_deviation)))
script.process.send(str(send_character))
script.process.expect(str(receive_character))

# End instruction
if script.standart_deviation is None:
if script.standard_deviation is None:
time.sleep(script.delay)
else:
time.sleep(abs(random.gauss(script.delay, script.standart_deviation)))
time.sleep(abs(random.gauss(script.delay, script.standard_deviation)))


class SendCharacterInstruction(Instruction):
Expand Down Expand Up @@ -129,10 +129,10 @@ def run(self, script):
super().run(script)
logger.debug("Send %s arrow %i times", self.send, self.num)
for _ in range(self.num):
if script.standart_deviation is None:
if script.standard_deviation is None:
time.sleep(script.delay)
else:
time.sleep(abs(random.gauss(script.delay, script.standart_deviation)))
time.sleep(abs(random.gauss(script.delay, script.standard_deviation)))
if self.enter:
script.process.sendline(self.mapping[self.send])
else:
Expand Down
4 changes: 2 additions & 2 deletions asciinema_automation/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(
asciinema_arguments: str,
wait,
delay,
standart_deviation,
standard_deviation,
timeout,
):
# Set members from arguments
Expand All @@ -58,7 +58,7 @@ def __init__(
self.asciinema_arguments = asciinema_arguments
self.delay = delay / 1000.0
self.wait = wait / 1000.0
self.standart_deviation = standart_deviation / 1000.0
self.standard_deviation = standard_deviation / 1000.0

# Default values for data members
self.expected = "\n"
Expand Down
2 changes: 1 addition & 1 deletion examples/backward_search.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rm my_first_file.txt
#$ delay 500

#$ send touch
#$ expect second
#$ expect second_file.txt

#$ wait 1000

Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# delay instructions change the time (or mean of gaussian if standart deviation is given) between key strokes
# delay instructions change the time (or mean of gaussian if standard deviation is given) between key strokes
#$ delay 50

echo "Hello world"
Expand Down
5 changes: 4 additions & 1 deletion examples/history.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions examples/special_character.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@

#$ expect \$
#$ sendcharacter #
This is a test with URL (https://github.com)
6 changes: 6 additions & 0 deletions tests/custom_rc_file_dumb_term
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export PS1="$ "
export HOME=~
export TERM=xterm
export PATH=/usr/bin:/usr/local/bin/
shopt -u checkwinsize
set enable-bracketed-paste off
6 changes: 6 additions & 0 deletions tests/custom_rc_file_xterm_term
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export PS1="$ "
export HOME=~
export TERM=xterm
export PATH=/usr/bin:/usr/local/bin/
shopt -u checkwinsize
set enable-bracketed-paste off
17 changes: 8 additions & 9 deletions tests/reference_output/asciinema_hello_world.cast
Original file line number Diff line number Diff line change
@@ -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
11 changes: 5 additions & 6 deletions tests/reference_output/autocompletion.cast
Original file line number Diff line number Diff line change
@@ -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
[?2004lmy_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
19 changes: 11 additions & 8 deletions tests/reference_output/backward_search.cast
Original file line number Diff line number Diff line change
@@ -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
[?2004lmy_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.txtu': touc': touch': touchtouch my_first
$ touch
$
$ ls my_first_file.txt
my_first_file.txt
$ exit
27 changes: 13 additions & 14 deletions tests/reference_output/change_structure.cast
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[?2004h$ mkdir my_directory
[?2004l[?2004h$ cd my_directory
[?2004l[?2004h$ basename $PWD
[?2004lmy_directory
[?2004h$ touch my_textfile.txt
[?2004l[?2004h$ ls
[?2004lmy_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
11 changes: 5 additions & 6 deletions tests/reference_output/escaped_command.cast
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[?2004h$ echo "Very" \
[?2004l[?2004h> "long" \
[?2004l[?2004h> "command"
[?2004lVery long command
[?2004h$ [?2004l
exit
$ echo "Very" \
> "long" \
> "command"
Very long command
$ exit
15 changes: 7 additions & 8 deletions tests/reference_output/hello_world.cast
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[?2004h$ echo "Hello world"
[?2004lHello world
[?2004h$ echo "I have waited 1000ms"
[?2004lI have waited 1000ms
[?2004h$ echo "I am writing with a 10ms delay"
[?2004lI 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
17 changes: 9 additions & 8 deletions tests/reference_output/history.cast
Original file line number Diff line number Diff line change
@@ -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
[?2004lmy_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
$ touch my_second_file.txt
$ touch my_first_file.txt
$ ls
my_first_file.txt my_second_file.txt
$ exit
78 changes: 47 additions & 31 deletions tests/reference_output/man_page.cast
Original file line number Diff line number Diff line change
@@ -1,31 +1,47 @@
[?2004h$ man echo
[?2004l[?1049h[?1h=ECHO(1) User Commands ECHO(1)

NAME
echo - display a line of text

SYNOPSIS
echo [SHORT-OPTION]... [STRING]...
echo LONG-OPTION

DESCRIPTION
Echo the STRING(s) to standard output.

-n do not output the trailing newline

-e enable interpretation of backslash escapes

-E disable interpretation of backslash escapes (default)

--help display this help and exit

--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
$ man echo
=
ECHO(1) User Commands ECHO(1)

NAME
echo - display a line of text

SYNOPSIS
echo [SHORT-OPTION]... [STRING]...
echo LONG-OPTION

DESCRIPTION
Echo the STRING(s) to standard output.

-n do not output the trailing newline

-e enable interpretation of backslash escapes

-E disable interpretation of backslash escapes (default)

--help display this help and exit

--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)
>$ exit
5 changes: 2 additions & 3 deletions tests/reference_output/special_character.cast
Original file line number Diff line number Diff line change
@@ -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
Loading