Skip to content

Commit

Permalink
Adding test for #363
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Dec 28, 2017
1 parent 434fb51 commit 46da89d
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,33 @@ def main(self):
print("hello world")


class AppA(cli.Application):
@cli.switch(['--one'])
def one(self):
pass

two = cli.SwitchAttr(['--two'])

class AppB(AppA):
@cli.switch(['--three'])
def three(self):
pass

four = cli.SwitchAttr(['--four'])

def main(self):
pass

# Testing #363
class TestInheritedApp:
def test_help(self, capsys):
_, rc = AppB.run(["AppB", "-h"], exit = False)
assert rc == 0
stdout, stderr = capsys.readouterr()
assert "--one" in stdout
assert "--two" in stdout
assert "--three" in stdout
assert "--four" in stdout

class TestCLI:
def test_meta_switches(self):
Expand Down Expand Up @@ -177,7 +204,7 @@ def test_env_var(self, capsys):
assert inst.eggs == 'raw'

def test_mandatory_env_var(self, capsys):

_, rc = SimpleApp.run(["arg"], exit = False)
assert rc == 2
stdout, stderr = capsys.readouterr()
Expand Down

0 comments on commit 46da89d

Please sign in to comment.