Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 300a8cd

Browse files
committed
Python: Add tests for the 'invoke' package
1 parent 6ddda1f commit 300a8cd

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
| invoke_test.py:8:27:8:52 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
2+
| invoke_test.py:9:35:9:60 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
3+
| invoke_test.py:13:32:13:57 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
4+
| invoke_test.py:14:40:14:65 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
5+
| invoke_test.py:19:26:19:51 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
6+
| invoke_test.py:20:27:20:52 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
7+
| invoke_test.py:24:27:24:52 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
8+
| invoke_test.py:31:26:31:51 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
9+
| invoke_test.py:38:26:38:51 | Comment # $getCommand="cmd1; cmd2" | Missing result:getCommand="cmd1; cmd2" |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import python
2+
import experimental.meta.ConceptsTest
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""tests for the 'invoke' package
2+
3+
see https://www.pyinvoke.org/
4+
"""
5+
6+
import invoke
7+
8+
invoke.run("cmd1; cmd2") # $getCommand="cmd1; cmd2"
9+
invoke.run(command="cmd1; cmd2") # $getCommand="cmd1; cmd2"
10+
11+
12+
def with_sudo():
13+
invoke.sudo("cmd1; cmd2") # $getCommand="cmd1; cmd2"
14+
invoke.sudo(command="cmd1; cmd2") # $getCommand="cmd1; cmd2"
15+
16+
17+
def manual_context():
18+
c = invoke.Context()
19+
c.run("cmd1; cmd2") # $getCommand="cmd1; cmd2"
20+
c.sudo("cmd1; cmd2") # $getCommand="cmd1; cmd2"
21+
22+
# invoke.Context is just an alias for invoke.context.Context
23+
c2 = invoke.context.Context()
24+
c2.run("cmd1; cmd2") # $getCommand="cmd1; cmd2"
25+
26+
27+
manual_context()
28+
29+
30+
def foo_helper(c):
31+
c.run("cmd1; cmd2") # $getCommand="cmd1; cmd2"
32+
33+
34+
# for use with the 'invoke' command-line tool
35+
@invoke.task
36+
def foo(c):
37+
# 'c' is a invoke.context.Context
38+
c.run("cmd1; cmd2") # $getCommand="cmd1; cmd2"
39+
foo_helper(c)

0 commit comments

Comments
 (0)