Added wait command.

development
Shawn Davis 4 years ago
parent 6158bc5374
commit c41b509385
  1. 4
      docs/source/_data/cloc.csv
  2. 13
      docs/source/_includes/overlays.rst
  3. 13
      scripttease/library/overlays/posix.py
  4. 6
      tests/test_library_overlays_posix.py

@ -1,3 +1,3 @@
files,language,blank,comment,code
22,Python,1044,918,1735
22,SUM,1044,918,1735
22,Python,1050,921,1740
22,SUM,1050,921,1740

1 files language blank comment code
2 22 Python 1044 1050 918 921 1735 1740
3 22 SUM 1044 1050 918 921 1735 1740

@ -898,6 +898,19 @@ Touch a file or directory.
[run touch command]
touch: path
wait
----
Pause execution for a number of seconds.
- seconds (int): The number of seconds to wait.
.. code-block:: ini
[run wait command]
wait: seconds
write
-----

@ -27,6 +27,7 @@ __all__ = (
"sed",
"symlink",
"touch",
"wait",
"Function",
"Prompt",
)
@ -542,6 +543,17 @@ def touch(path, **kwargs):
return Command("touch %s" % path, **kwargs)
def wait(seconds, **kwargs):
"""Pause execution for a number of seconds.
- seconds (int): The number of seconds to wait.
"""
kwargs.setdefault("comment", "pause for %s seconds" % seconds)
return Command("sleep %s" % seconds, **kwargs)
# Classes
@ -740,5 +752,6 @@ POSIX_MAPPINGS = {
'ssl': certbot,
'symlink': symlink,
'touch': touch,
'wait': wait,
'write': file_write,
}

@ -219,6 +219,12 @@ def test_touch():
assert "touch /path/to/file.txt" in c.get_statement()
def test_wait():
c = wait(5)
s = c.get_statement()
assert 'sleep 5' in s
class TestFunction(object):
def test_to_string(self):

Loading…
Cancel
Save