From 46da89d8b2c53c2c6bf3ee30f7e013a326af219b Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Thu, 28 Dec 2017 12:36:00 -0500 Subject: [PATCH] Adding test for #363 --- tests/test_cli.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 4c762798e..95bc7c636 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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): @@ -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()