Ejemplo n.º 1
0
 def test_main(self, N, Process, virtual_memory):
     """
     Test whether gpustat.main() works well. The behavior is mocked
     exactly as in test_new_query_mocked().
     """
     _configure_mock(N, Process, virtual_memory)
     sys.argv = ['gpustat']
     gpustat.main()
Ejemplo n.º 2
0
 def test_main(self, N, Process):
     """
     Test whether gpustat.main() works well. The behavior is mocked
     exactly as in test_new_query_mocked().
     """
     _configure_mock(N, Process)
     sys.argv = ['gpustat']
     gpustat.main()
Ejemplo n.º 3
0
        def capture_output(*args):
            f = StringIO()
            import contextlib

            with contextlib.redirect_stdout(f):  # requires python 3.4+
                try:
                    gpustat.main(*args)
                except SystemExit:
                    raise AssertionError("Argparse failed (see above error message)")
            return f.getvalue()
Ejemplo n.º 4
0
        def capture_output(*args):
            f = StringIO()
            import contextlib

            with contextlib.redirect_stdout(f):  # requires python 3.4+
                try:
                    gpustat.main(*args)
                except SystemExit:
                    raise AssertionError(
                        "Argparse failed (see above error message)"
                    )
            return f.getvalue()
Ejemplo n.º 5
0
 def test_main(self, scenario_basic):
     """Test whether gpustat.main() works well.
     The behavior is mocked exactly as in test_new_query_mocked().
     """
     sys.argv = ['gpustat']
     gpustat.main()