コード例 #1
0
ファイル: test_cli.py プロジェクト: firebitsbr/benchOpt
    def test_plot_invalid_kind(self):

        with pytest.raises(ValueError, match=r"invalid_kind"):

            plot([str(DUMMY_BENCHMARK_PATH), '-k', 'invalid_kind'],
                 'benchopt',
                 standalone_mode=False)
コード例 #2
0
ファイル: test_cli.py プロジェクト: zaccharieramzi/benchOpt
    def test_plot_html_ignore_kind(self):

        with pytest.warns(UserWarning, match=r"Cannot specify '--kind'"):
            plot([
                str(DUMMY_BENCHMARK_PATH), '-k', 'invalid_kind', '--html',
                '--no-display'
            ],
                 'benchopt',
                 standalone_mode=False)
コード例 #3
0
ファイル: test_cli.py プロジェクト: zaccharieramzi/benchOpt
    def test_plot_invalid_file(self):

        with pytest.raises(FileNotFoundError, match=r"invalid_file"):
            plot([
                str(DUMMY_BENCHMARK_PATH), '-f', 'invalid_file', '--no-html',
                '--no-display'
            ],
                 'benchopt',
                 standalone_mode=False)
コード例 #4
0
ファイル: test_cli.py プロジェクト: tomMoral/benchOpt
    def test_valid_call(self, kind):

        with SuppressStd() as out:
            plot([str(DUMMY_BENCHMARK_PATH), '-f', self.result_file,
                  '-k', kind, '--no-display', '--no-html'],
                 'benchopt', standalone_mode=False)
        saved_files = re.findall(r'Save .* as: (.*\.pdf)', out.output)
        assert len(saved_files) == 1
        saved_file = saved_files[0]
        assert kind in saved_file

        Path(saved_file).unlink()
コード例 #5
0
ファイル: test_cli.py プロジェクト: zaccharieramzi/benchOpt
    def test_valid_call_html(self):

        with SuppressStd() as out:
            plot([
                str(DUMMY_BENCHMARK_PATH), '-f', self.result_file,
                '--no-display', '--html'
            ],
                 'benchopt',
                 standalone_mode=False)

        saved_files = re.findall(r'Writing.* results to (.*\.html)',
                                 out.output)
        try:
            assert len(saved_files) == 2
        finally:
            # Make sure to clean up all files even when the test fails
            for f in saved_files:
                Path(f).unlink()
コード例 #6
0
ファイル: test_cli.py プロジェクト: zaccharieramzi/benchOpt
    def test_valid_call(self, kind):

        with SuppressStd() as out:
            plot([
                str(DUMMY_BENCHMARK_PATH), '-f', self.result_file, '-k', kind,
                '--no-display', '--no-html'
            ],
                 'benchopt',
                 standalone_mode=False)

        saved_files = re.findall(r'Save .* as: (.*\.pdf)', out.output)
        try:
            assert len(saved_files) == 1
            assert kind in saved_files[0]
        finally:
            # Make sure to clean up all files even when the test fails
            for f in saved_files:
                Path(f).unlink()