Example #1
0
    def test_parsing_commandline_build_file(self):
        assert "some_file" == _nb._create_parser().parse_args(
            ["-f", "some_file"]).file
        assert "build.py" == _nb._create_parser().parse_args([]).file
        assert ("/foo/bar" == _nb._create_parser().parse_args(
            ["--file", "/foo/bar"]).file)

        with pytest.raises(SystemExit):
            _nb._create_parser().parse_args(["--file"])
        with pytest.raises(SystemExit):
            _nb._create_parser().parse_args(["-f"])
Example #2
0
 def test_parsing_commandline_help(self):
     assert _nb._create_parser().parse_args(["-l"]).list_tasks
     assert _nb._create_parser().parse_args(["--list-tasks"]).list_tasks
Example #3
0
 def test_parsing_commandline(self):
     args = _nb._create_parser().parse_args(
         ["-f", "foo.py", "task1", "task2"])
     assert "foo.py" == args.file
     assert not args.list_tasks
     assert ["task1", "task2"] == args.tasks