Пример #1
0
                def base_case(self):
                    expected = """Available tasks ('*' denotes collection defaults):

  shell (ipython)           Load a REPL with project state already set up.
  test* (run-tests)         Run the test suite with baked-in args.
  build                     Tasks for compiling static code and assets.
      .all* (.everything)   Build all necessary artifacts.
      .c-ext (.ext)         Build our internal C extension.
      .zap                  A silly way to clean.
      .docs                 Tasks for managing Sphinx docs.
          .all*             Build all doc formats.
          .html             Build HTML output only.
          .pdf              Build PDF output only.
      .python               PyPI/etc distribution artifacts.
          .all*             Build all Python packages.
          .sdist            Build classic style tar.gz.
          .wheel            Build a wheel.
  deploy                    How to deploy our code and configs.
      .db (.db-servers)     Deploy to our database servers.
      .everywhere*          Deploy to all targets.
      .web                  Update and bounce the webservers.
  provision                 System setup code.
      .db                   Stand up one or more DB servers.
      .web                  Stand up a Web server.

Default task: test

"""
                    stdout, _ = run("-c tree -l -F nested")
                    assert expected == stdout
Пример #2
0
            def flat_is_legacy_default_format(self):
                # Sanity test that --list --list-format=flat is the same as the
                # old "just --list".
                expected = """Available tasks:

  shell (ipython)                       Load a REPL with project state already
                                        set up.
  test (run-tests)                      Run the test suite with baked-in args.
  build.all (build, build.everything)   Build all necessary artifacts.
  build.c-ext (build.ext)               Build our internal C extension.
  build.zap                             A silly way to clean.
  build.docs.all (build.docs)           Build all doc formats.
  build.docs.html                       Build HTML output only.
  build.docs.pdf                        Build PDF output only.
  build.python.all (build.python)       Build all Python packages.
  build.python.sdist                    Build classic style tar.gz.
  build.python.wheel                    Build a wheel.
  deploy.db (deploy.db-servers)         Deploy to our database servers.
  deploy.everywhere (deploy)            Deploy to all targets.
  deploy.web                            Update and bounce the webservers.
  provision.db                          Stand up one or more DB servers.
  provision.web                         Stand up a Web server.

Default task: test

"""
                stdout, _ = run("-c tree --list --list-format=flat")
                assert expected == stdout
Пример #3
0
                def depth_arg_deeper_than_real_depth(self):
                    expected = """Available tasks (depth=5; '*' denotes collection defaults):

  shell (ipython)           Load a REPL with project state already set up.
  test* (run-tests)         Run the test suite with baked-in args.
  build                     Tasks for compiling static code and assets.
      .all* (.everything)   Build all necessary artifacts.
      .c-ext (.ext)         Build our internal C extension.
      .zap                  A silly way to clean.
      .docs                 Tasks for managing Sphinx docs.
          .all*             Build all doc formats.
          .html             Build HTML output only.
          .pdf              Build PDF output only.
      .python               PyPI/etc distribution artifacts.
          .all*             Build all Python packages.
          .sdist            Build classic style tar.gz.
          .wheel            Build a wheel.
  deploy                    How to deploy our code and configs.
      .db (.db-servers)     Deploy to our database servers.
      .everywhere*          Deploy to all targets.
      .web                  Update and bounce the webservers.
  provision                 System setup code.
      .db                   Stand up one or more DB servers.
      .web                  Stand up a Web server.

Default task: test

"""
                    stdout, _ = run("-c tree -l -F nested --list-depth 5")
                    assert expected == stdout
Пример #4
0
 def uses_overridden_value_when_given(self):
     stdout, _ = run(
         "myapp --help",
         invoke=False,
         program=Program(binary='nope'),
     )
     assert "nope [--core-opts]" in stdout
Пример #5
0
 def contains_truly_core_arguments_regardless_of_namespace_value(self):
     # Spot check. See integration-style --help tests for full argument
     # checkup.
     for program in (Program(), Program(namespace=Collection())):
         for arg in ("--complete", "--debug", "--warn-only", "--list"):
             stdout, _ = run("--help", program=program)
             assert arg in stdout
Пример #6
0
 def contains_truly_core_arguments_regardless_of_namespace_value(self):
     # Spot check. See integration-style --help tests for full argument
     # checkup.
     for program in (Program(), Program(namespace=Collection())):
         for arg in ('--complete', '--debug', '--warn-only', '--list'):
             stdout, _ = run("--help", program=program)
             assert arg in stdout
Пример #7
0
        def nontrivial_trees_are_sorted_by_namespace_and_depth(self):
            # By using a larger sample, we can guard against unintuitive
            # behaviors arising from the above simple unit style tests. E.g.
            # earlier implementations 'broke up' collections that had more than
            # 2 levels of depth, because they displayed all 2nd-level tasks
            # before any 3rd-level ones.
            # The code must square that concern against "show shallow tasks
            # before deep ones" (vs straight up alpha sorting)
            expected = """Available tasks:

  shell (ipython)                       Load a REPL with project state already
                                        set up.
  test (run-tests)                      Run the test suite with baked-in args.
  build.all (build, build.everything)   Build all necessary artifacts.
  build.c-ext (build.ext)               Build our internal C extension.
  build.zap                             A silly way to clean.
  build.docs.all (build.docs)           Build all doc formats.
  build.docs.html                       Build HTML output only.
  build.docs.pdf                        Build PDF output only.
  build.python.all (build.python)       Build all Python packages.
  build.python.sdist                    Build classic style tar.gz.
  build.python.wheel                    Build a wheel.
  deploy.db (deploy.db-servers)         Deploy to our database servers.
  deploy.everywhere (deploy)            Deploy to all targets.
  deploy.web                            Update and bounce the webservers.
  provision.db                          Stand up one or more DB servers.
  provision.web                         Stand up a Web server.

Default task: test

"""
            stdout, _ = run("-c tree --list")
            assert expected == stdout
Пример #8
0
            def flat_is_legacy_default_format(self):
                # Sanity test that --list --list-format=flat is the same as the
                # old "just --list".
                expected = """Available tasks:

  shell (ipython)                       Load a REPL with project state already
                                        set up.
  test (run-tests)                      Run the test suite with baked-in args.
  build.all (build, build.everything)   Build all necessary artifacts.
  build.c-ext (build.ext)               Build our internal C extension.
  build.zap                             A silly way to clean.
  build.docs.all (build.docs)           Build all doc formats.
  build.docs.html                       Build HTML output only.
  build.docs.pdf                        Build PDF output only.
  build.python.all (build.python)       Build all Python packages.
  build.python.sdist                    Build classic style tar.gz.
  build.python.wheel                    Build a wheel.
  deploy.db (deploy.db-servers)         Deploy to our database servers.
  deploy.everywhere (deploy)            Deploy to all targets.
  deploy.web                            Update and bounce the webservers.
  provision.db                          Stand up one or more DB servers.
  provision.web                         Stand up a Web server.

Default task: test

"""
                stdout, _ = run("-c tree --list --list-format=flat")
                assert expected == stdout
Пример #9
0
            def depth_can_be_deeper_than_real_depth(self):
                # Edge case: depth > actual depth = same as no depth arg
                expected = """Available tasks (depth=5):

  shell (ipython)                       Load a REPL with project state already
                                        set up.
  test (run-tests)                      Run the test suite with baked-in args.
  build.all (build, build.everything)   Build all necessary artifacts.
  build.c-ext (build.ext)               Build our internal C extension.
  build.zap                             A silly way to clean.
  build.docs.all (build.docs)           Build all doc formats.
  build.docs.html                       Build HTML output only.
  build.docs.pdf                        Build PDF output only.
  build.python.all (build.python)       Build all Python packages.
  build.python.sdist                    Build classic style tar.gz.
  build.python.wheel                    Build a wheel.
  deploy.db (deploy.db-servers)         Deploy to our database servers.
  deploy.everywhere (deploy)            Deploy to all targets.
  deploy.web                            Update and bounce the webservers.
  provision.db                          Stand up one or more DB servers.
  provision.web                         Stand up a Web server.

Default task: test

"""
                stdout, _ = run("-c tree --list --list-depth=5")
                assert expected == stdout
Пример #10
0
            def depth_can_be_deeper_than_real_depth(self):
                # Edge case: depth > actual depth = same as no depth arg
                expected = """Available tasks (depth=5):

  shell (ipython)                       Load a REPL with project state already
                                        set up.
  test (run-tests)                      Run the test suite with baked-in args.
  build.all (build, build.everything)   Build all necessary artifacts.
  build.c-ext (build.ext)               Build our internal C extension.
  build.zap                             A silly way to clean.
  build.docs.all (build.docs)           Build all doc formats.
  build.docs.html                       Build HTML output only.
  build.docs.pdf                        Build PDF output only.
  build.python.all (build.python)       Build all Python packages.
  build.python.sdist                    Build classic style tar.gz.
  build.python.wheel                    Build a wheel.
  deploy.db (deploy.db-servers)         Deploy to our database servers.
  deploy.everywhere (deploy)            Deploy to all targets.
  deploy.web                            Update and bounce the webservers.
  provision.db                          Stand up one or more DB servers.
  provision.web                         Stand up a Web server.

Default task: test

"""
                stdout, _ = run("-c tree --list --list-depth=5")
                assert expected == stdout
Пример #11
0
        def nontrivial_trees_are_sorted_by_namespace_and_depth(self):
            # By using a larger sample, we can guard against unintuitive
            # behaviors arising from the above simple unit style tests. E.g.
            # earlier implementations 'broke up' collections that had more than
            # 2 levels of depth, because they displayed all 2nd-level tasks
            # before any 3rd-level ones.
            # The code must square that concern against "show shallow tasks
            # before deep ones" (vs straight up alpha sorting)
            expected = """Available tasks:

  shell (ipython)                       Load a REPL with project state already
                                        set up.
  test (run-tests)                      Run the test suite with baked-in args.
  build.all (build, build.everything)   Build all necessary artifacts.
  build.c-ext (build.ext)               Build our internal C extension.
  build.zap                             A silly way to clean.
  build.docs.all (build.docs)           Build all doc formats.
  build.docs.html                       Build HTML output only.
  build.docs.pdf                        Build PDF output only.
  build.python.all (build.python)       Build all Python packages.
  build.python.sdist                    Build classic style tar.gz.
  build.python.wheel                    Build a wheel.
  deploy.db (deploy.db-servers)         Deploy to our database servers.
  deploy.everywhere (deploy)            Deploy to all targets.
  deploy.web                            Update and bounce the webservers.
  provision.db                          Stand up one or more DB servers.
  provision.web                         Stand up a Web server.

Default task: test

"""
            stdout, _ = run("-c tree --list")
            assert expected == stdout
Пример #12
0
 def can_be_given_directly(self):
     program = Program(binary_names=["foo", "bar"])
     stdout, _ = run(
         "foo --print-completion-script zsh",
         invoke=False,
         program=program,
     )
     assert " foo bar" in stdout
Пример #13
0
            def argument_may_be_a_nested_namespace(self):
                stdout, _ = run("-c tree --list build.docs")
                expected = """Available 'build.docs' tasks:

  .all    Build all doc formats.
  .html   Build HTML output only.
  .pdf    Build PDF output only.

Default 'build.docs' task: .all

"""
                assert expected == stdout
Пример #14
0
            def argument_may_be_a_nested_namespace(self):
                stdout, _ = run("-c tree --list build.docs")
                expected = """Available 'build.docs' tasks:

  .all    Build all doc formats.
  .html   Build HTML output only.
  .pdf    Build PDF output only.

Default 'build.docs' task: .all

"""
                assert expected == stdout
Пример #15
0
                def all_possible_options(self):
                    expected = """Available 'build' tasks (depth=1; '*' denotes collection defaults):

  .all* (.everything)   Build all necessary artifacts.
  .c-ext (.ext)         Build our internal C extension.
  .zap                  A silly way to clean.
  .docs [3 tasks]       Tasks for managing Sphinx docs.
  .python [3 tasks]     PyPI/etc distribution artifacts.

Default 'build' task: .all

"""
                    stdout, _ = run("-c tree -l build -F nested -D1")
                    assert expected == stdout
Пример #16
0
            def works_with_explicit_namespace(self):
                expected = """Available 'build' tasks (depth=1):

  .all (.everything)   Build all necessary artifacts.
  .c-ext (.ext)        Build our internal C extension.
  .zap                 A silly way to clean.
  .docs [3 tasks]      Tasks for managing Sphinx docs.
  .python [3 tasks]    PyPI/etc distribution artifacts.

Default 'build' task: .all

"""
                stdout, _ = run("-c tree --list build --list-depth=1")
                assert expected == stdout
Пример #17
0
                def all_possible_options(self):
                    expected = """Available 'build' tasks (depth=1; '*' denotes collection defaults):

  .all* (.everything)   Build all necessary artifacts.
  .c-ext (.ext)         Build our internal C extension.
  .zap                  A silly way to clean.
  .docs [3 tasks]       Tasks for managing Sphinx docs.
  .python [3 tasks]     PyPI/etc distribution artifacts.

Default 'build' task: .all

"""
                    stdout, _ = run("-c tree -l build -F nested -D1")
                    assert expected == stdout
Пример #18
0
            def works_with_explicit_namespace(self):
                expected = """Available 'build' tasks (depth=1):

  .all (.everything)   Build all necessary artifacts.
  .c-ext (.ext)        Build our internal C extension.
  .zap                 A silly way to clean.
  .docs [3 tasks]      Tasks for managing Sphinx docs.
  .python [3 tasks]    PyPI/etc distribution artifacts.

Default 'build' task: .all

"""
                stdout, _ = run("-c tree --list build --list-depth=1")
                assert expected == stdout
Пример #19
0
            def short_flag_is_D(self):
                expected = """Available tasks (depth=1):

  shell (ipython)                  Load a REPL with project state already set
                                   up.
  test (run-tests)                 Run the test suite with baked-in args.
  build [3 tasks, 2 collections]   Tasks for compiling static code and assets.
  deploy [3 tasks]                 How to deploy our code and configs.
  provision [2 tasks]              System setup code.

Default task: test

"""
                stdout, _ = run("-c tree --list --list-format=flat -D 1")
                assert expected == stdout
Пример #20
0
            def short_flag_is_D(self):
                expected = """Available tasks (depth=1):

  shell (ipython)                  Load a REPL with project state already set
                                   up.
  test (run-tests)                 Run the test suite with baked-in args.
  build [3 tasks, 2 collections]   Tasks for compiling static code and assets.
  deploy [3 tasks]                 How to deploy our code and configs.
  provision [2 tasks]              System setup code.

Default task: test

"""
                stdout, _ = run("-c tree --list --list-format=flat -D 1")
                assert expected == stdout
Пример #21
0
            def limits_display_to_given_depth(self):
                # Base case: depth=1 aka "show me the namespaces"
                expected = """Available tasks (depth=1):

  shell (ipython)                  Load a REPL with project state already set
                                   up.
  test (run-tests)                 Run the test suite with baked-in args.
  build [3 tasks, 2 collections]   Tasks for compiling static code and assets.
  deploy [3 tasks]                 How to deploy our code and configs.
  provision [2 tasks]              System setup code.

Default task: test

"""
                stdout, _ = run("-c tree --list -F flat --list-depth 1")
                assert expected == stdout
Пример #22
0
            def limits_display_to_given_depth(self):
                # Base case: depth=1 aka "show me the namespaces"
                expected = """Available tasks (depth=1):

  shell (ipython)                  Load a REPL with project state already set
                                   up.
  test (run-tests)                 Run the test suite with baked-in args.
  build [3 tasks, 2 collections]   Tasks for compiling static code and assets.
  deploy [3 tasks]                 How to deploy our code and configs.
  provision [2 tasks]              System setup code.

Default task: test

"""
                stdout, _ = run("-c tree --list -F flat --list-depth 1")
                assert expected == stdout
Пример #23
0
            def argument_limits_display_to_given_namespace(self):
                stdout, _ = run("-c tree --list build")
                expected = """Available 'build' tasks:

  .all (.everything)      Build all necessary artifacts.
  .c-ext (.ext)           Build our internal C extension.
  .zap                    A silly way to clean.
  .docs.all (.docs)       Build all doc formats.
  .docs.html              Build HTML output only.
  .docs.pdf               Build PDF output only.
  .python.all (.python)   Build all Python packages.
  .python.sdist           Build classic style tar.gz.
  .python.wheel           Build a wheel.

Default 'build' task: .all

"""
                assert expected == stdout
Пример #24
0
            def argument_limits_display_to_given_namespace(self):
                stdout, _ = run("-c tree --list build")
                expected = """Available 'build' tasks:

  .all (.everything)      Build all necessary artifacts.
  .c-ext (.ext)           Build our internal C extension.
  .zap                    A silly way to clean.
  .docs.all (.docs)       Build all doc formats.
  .docs.html              Build HTML output only.
  .docs.pdf               Build PDF output only.
  .python.all (.python)   Build all Python packages.
  .python.sdist           Build classic style tar.gz.
  .python.wheel           Build a wheel.

Default 'build' task: .all

"""
                assert expected == stdout
Пример #25
0
 def bundled_namespace_help_includes_subcommand_listing(self):
     t1, t2 = Task(Mock()), Task(Mock())
     coll = Collection(task1=t1, task2=t2)
     p = Program(namespace=coll)
     # Spot checks for expected bits, so we don't have to change
     # this every time core args change.
     for expected in (
         # Usage line changes somewhat
         "Usage: myapp [--core-opts] <subcommand> [--subcommand-opts] ...\n", # noqa
         # Core options are still present
         "Core options:\n",
         "--echo",
         # Subcommands are listed
         "Subcommands:\n",
         "  task1",
         "  task2",
     ):
         stdout, _ = run("myapp --help", program=p, invoke=False)
         assert expected in stdout
Пример #26
0
 def bundled_namespace_help_includes_subcommand_listing(self):
     t1, t2 = Task(Mock()), Task(Mock())
     coll = Collection(task1=t1, task2=t2)
     p = Program(namespace=coll)
     # Spot checks for expected bits, so we don't have to change
     # this every time core args change.
     for expected in (
             # Usage line changes somewhat
             "Usage: myapp [--core-opts] <subcommand> [--subcommand-opts] ...\n",  # noqa
             # Core options are still present
             "Core options:\n",
             "--echo",
             # Subcommands are listed
             "Subcommands:\n",
             "  task1",
             "  task2",
     ):
         stdout, _ = run("myapp --help", program=p, invoke=False)
         assert expected in stdout
Пример #27
0
                def honors_namespace_arg_to_list(self):
                    stdout, _ = run("-c tree --list build -F nested")
                    expected = """Available 'build' tasks ('*' denotes collection defaults):

  .all* (.everything)   Build all necessary artifacts.
  .c-ext (.ext)         Build our internal C extension.
  .zap                  A silly way to clean.
  .docs                 Tasks for managing Sphinx docs.
      .all*             Build all doc formats.
      .html             Build HTML output only.
      .pdf              Build PDF output only.
  .python               PyPI/etc distribution artifacts.
      .all*             Build all Python packages.
      .sdist            Build classic style tar.gz.
      .wheel            Build a wheel.

Default 'build' task: .all

"""
                    assert expected == stdout
Пример #28
0
                def honors_namespace_arg_to_list(self):
                    stdout, _ = run("-c tree --list build -F nested")
                    expected = """Available 'build' tasks ('*' denotes collection defaults):

  .all* (.everything)   Build all necessary artifacts.
  .c-ext (.ext)         Build our internal C extension.
  .zap                  A silly way to clean.
  .docs                 Tasks for managing Sphinx docs.
      .all*             Build all doc formats.
      .html             Build HTML output only.
      .pdf              Build PDF output only.
  .python               PyPI/etc distribution artifacts.
      .all*             Build all Python packages.
      .sdist            Build classic style tar.gz.
      .wheel            Build a wheel.

Default 'build' task: .all

"""
                    assert expected == stdout
Пример #29
0
            def non_base_case(self):
                # Middle case: depth=2
                expected = """Available tasks (depth=2):

  shell (ipython)                       Load a REPL with project state already
                                        set up.
  test (run-tests)                      Run the test suite with baked-in args.
  build.all (build, build.everything)   Build all necessary artifacts.
  build.c-ext (build.ext)               Build our internal C extension.
  build.zap                             A silly way to clean.
  build.docs [3 tasks]                  Tasks for managing Sphinx docs.
  build.python [3 tasks]                PyPI/etc distribution artifacts.
  deploy.db (deploy.db-servers)         Deploy to our database servers.
  deploy.everywhere (deploy)            Deploy to all targets.
  deploy.web                            Update and bounce the webservers.
  provision.db                          Stand up one or more DB servers.
  provision.web                         Stand up a Web server.

Default task: test

"""
                stdout, _ = run("-c tree --list --list-depth=2")
                assert expected == stdout
Пример #30
0
            def non_base_case(self):
                # Middle case: depth=2
                expected = """Available tasks (depth=2):

  shell (ipython)                       Load a REPL with project state already
                                        set up.
  test (run-tests)                      Run the test suite with baked-in args.
  build.all (build, build.everything)   Build all necessary artifacts.
  build.c-ext (build.ext)               Build our internal C extension.
  build.zap                             A silly way to clean.
  build.docs [3 tasks]                  Tasks for managing Sphinx docs.
  build.python [3 tasks]                PyPI/etc distribution artifacts.
  deploy.db (deploy.db-servers)         Deploy to our database servers.
  deploy.everywhere (deploy)            Deploy to all targets.
  deploy.web                            Update and bounce the webservers.
  provision.db                          Stand up one or more DB servers.
  provision.web                         Stand up a Web server.

Default task: test

"""
                stdout, _ = run("-c tree --list --list-depth=2")
                assert expected == stdout
Пример #31
0
                def honors_depth_arg(self):
                    expected = """Available tasks (depth=2; '*' denotes collection defaults):

  shell (ipython)           Load a REPL with project state already set up.
  test* (run-tests)         Run the test suite with baked-in args.
  build                     Tasks for compiling static code and assets.
      .all* (.everything)   Build all necessary artifacts.
      .c-ext (.ext)         Build our internal C extension.
      .zap                  A silly way to clean.
      .docs [3 tasks]       Tasks for managing Sphinx docs.
      .python [3 tasks]     PyPI/etc distribution artifacts.
  deploy                    How to deploy our code and configs.
      .db (.db-servers)     Deploy to our database servers.
      .everywhere*          Deploy to all targets.
      .web                  Update and bounce the webservers.
  provision                 System setup code.
      .db                   Stand up one or more DB servers.
      .web                  Stand up a Web server.

Default task: test

"""
                    stdout, _ = run("-c tree -l -F nested --list-depth 2")
                    assert expected == stdout
Пример #32
0
                def honors_depth_arg(self):
                    expected = """Available tasks (depth=2; '*' denotes collection defaults):

  shell (ipython)           Load a REPL with project state already set up.
  test* (run-tests)         Run the test suite with baked-in args.
  build                     Tasks for compiling static code and assets.
      .all* (.everything)   Build all necessary artifacts.
      .c-ext (.ext)         Build our internal C extension.
      .zap                  A silly way to clean.
      .docs [3 tasks]       Tasks for managing Sphinx docs.
      .python [3 tasks]     PyPI/etc distribution artifacts.
  deploy                    How to deploy our code and configs.
      .db (.db-servers)     Deploy to our database servers.
      .everywhere*          Deploy to all targets.
      .web                  Update and bounce the webservers.
  provision                 System setup code.
      .db                   Stand up one or more DB servers.
      .web                  Stand up a Web server.

Default task: test

"""
                    stdout, _ = run("-c tree -l -F nested --list-depth 2")
                    assert expected == stdout
Пример #33
0
 def core_help_doesnt_get_mad_if_loading_fails(self):
     # Expects no tasks.py in root of FS
     with cd(ROOT):
         stdout, _ = run("--help")
         assert "Usage: " in stdout
Пример #34
0
 def non_null_namespace_does_not_trigger_task_related_args(self):
     for arg in Program().task_args():
         program = Program(namespace=Collection(mytask=Task(Mock())))
         stdout, _ = run("--help", program=program)
         assert arg.name not in stdout
Пример #35
0
 def empty_invocation_with_no_default_task_prints_help(self):
     stdout, _ = run("-c foo")
     assert "Core options:" in stdout
Пример #36
0
 def does_not_honor_depth_arg_even_with_namespace(self):
     _, stderr = run("-c tree -l build -F json -D 2")
     expected = "The --list-depth option is not supported with JSON format!\n" # noqa
     assert expected == stderr
Пример #37
0
 def honors_program_binary(self):
     stdout, _ = run(
         "-c decorators -h biz", program=Program(binary='notinvoke')
     )
     assert "Usage: notinvoke" in stdout
Пример #38
0
 def defaults_to_argv_when_None(self):
     stdout, _ = run("foo --print-completion-script zsh", invoke=False)
     assert " foo" in stdout
Пример #39
0
 def uses_overridden_value_when_given(self):
     stdout, _ = run(
         "myapp --help", invoke=False, program=Program(binary='nope'),
     )
     assert "nope [--core-opts]" in stdout
Пример #40
0
 def does_not_honor_depth_arg_even_with_namespace(self):
     _, stderr = run("-c tree -l build -F json -D 2")
     expected = "The --list-depth option is not supported with JSON format!\n"  # noqa
     assert expected == stderr
Пример #41
0
 def defaults_to_argv_when_None(self):
     stdout, _ = run("myapp --help", invoke=False)
     assert "myapp [--core-opts]" in stdout
Пример #42
0
 def does_not_honor_depth_arg(self):
     _, stderr = run("-c tree -l --list-format json -D 2")
     expected = "The --list-depth option is not supported with JSON format!\n"  # noqa
     assert expected == stderr
Пример #43
0
 def honors_namespace_arg_to_list(self):
     stdout, _ = run("-c tree --list deploy --list-format=json")
     expected = self.by_name["deploy"]
     assert expected == json.loads(stdout)
Пример #44
0
 def base_case(self):
     stdout, _ = run("-c tree --list --list-format=json")
     assert self.tree == json.loads(stdout)
Пример #45
0
 def honors_program_binary(self):
     stdout, _ = run("-c decorators -h biz",
                     program=Program(binary="notinvoke"))
     assert "Usage: notinvoke" in stdout
Пример #46
0
 def core_help_doesnt_get_mad_if_loading_fails(self):
     # Expects no tasks.py in root of FS
     with cd(ROOT):
         stdout, _ = run("--help")
         assert "Usage: " in stdout
Пример #47
0
 def null_namespace_triggers_task_related_args(self):
     program = Program(namespace=None)
     for arg in program.task_args():
         stdout, _ = run("--help", program=program)
         assert arg.name in stdout
Пример #48
0
 def does_not_honor_depth_arg(self):
     _, stderr = run("-c tree -l --list-format json -D 2")
     expected = "The --list-depth option is not supported with JSON format!\n" # noqa
     assert expected == stderr
Пример #49
0
 def defaults_to_argv_when_None(self):
     stdout, _ = run("myapp --help", invoke=False)
     assert "myapp [--core-opts]" in stdout
Пример #50
0
 def base_case(self):
     stdout, _ = run("-c tree --list --list-format=json")
     assert self.tree == json.loads(stdout)
Пример #51
0
 def empty_invocation_with_no_default_task_prints_help(self):
     stdout, _ = run("-c foo")
     assert "Core options:" in stdout
Пример #52
0
def run_experiment(size, num_iter=3):
    vector = array('l', range(size))
    return _util.run(norm_square_array, vector, num_iter)
Пример #53
0
 def honors_namespace_arg_to_list(self):
     stdout, _ = run("-c tree --list build --list-format=json")
     expected = self.by_name['build']
     assert expected == json.loads(stdout)
Пример #54
0
 def null_namespace_triggers_task_related_args(self):
     program = Program(namespace=None)
     for arg in program.task_args():
         stdout, _ = run("--help", program=program)
         assert arg.name in stdout
def run_experiment(size, num_iter=3):
    vector = array('l', range(size))
    return _util.run(norm_square_array, vector, num_iter)
Пример #56
0
 def non_null_namespace_does_not_trigger_task_related_args(self):
     for arg in Program().task_args():
         program = Program(namespace=Collection(mytask=Task(Mock())))
         stdout, _ = run("--help", program=program)
         assert arg.name not in stdout
def run_experiment(size, num_iter=3):
    vector = numpy.arange(size)
    return _util.run(norm_square_numpy_dot, vector, num_iter)
def run_experiment(size, num_iter=3):
    vector = range(size)
    return _util.run(norm_squared_generator_comprehension, vector, num_iter)
Пример #59
0
def run_experiment(size, num_iter=3):
    vector = range(size)
    return _util.run(norm_square_list, vector, num_iter)
def run_experiment(size, num_iter=3):
    vector = range(size)
    return _util.run(norm_square_list, vector, num_iter)