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()
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()
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()
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()
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()