Show More
@@ -0,0 +1,35 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | # This program is free software: you can redistribute it and/or modify | |||
|
3 | # it under the terms of the GNU General Public License as published by | |||
|
4 | # the Free Software Foundation, either version 3 of the License, or | |||
|
5 | # (at your option) any later version. | |||
|
6 | # | |||
|
7 | # This program is distributed in the hope that it will be useful, | |||
|
8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
10 | # GNU General Public License for more details. | |||
|
11 | # | |||
|
12 | # You should have received a copy of the GNU General Public License | |||
|
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
|
14 | ||||
|
15 | import pytest | |||
|
16 | from kallithea.model.db import Repository | |||
|
17 | from kallithea.tests.base import * | |||
|
18 | ||||
|
19 | @pytest.mark.skipif("not os.environ.has_key('TEST_PERFORMANCE')", reason="skipping performance tests, set TEST_PERFORMANCE in environment if desired") | |||
|
20 | class TestVCSPerformance(TestController): | |||
|
21 | ||||
|
22 | def graphmod(self, repo): | |||
|
23 | """ Simple test for running the graph_data function for profiling/testing performance. """ | |||
|
24 | from kallithea.lib.graphmod import graph_data | |||
|
25 | dbr = Repository.get_by_repo_name(repo) | |||
|
26 | scm_inst = dbr.scm_instance | |||
|
27 | collection = scm_inst.get_changesets(start=0, end=None, branch_name=None) | |||
|
28 | revs = [x.revision for x in collection] | |||
|
29 | jsdata = graph_data(scm_inst, revs) | |||
|
30 | ||||
|
31 | def test_graphmod_hg(self, benchmark): | |||
|
32 | self.graphmod(HG_REPO) | |||
|
33 | ||||
|
34 | def test_graphmod_git(self, benchmark): | |||
|
35 | self.graphmod(GIT_REPO) |
@@ -98,6 +98,17 b' are::' | |||||
98 | -s, --capture=no don't capture stdout (any stdout output will be |
|
98 | -s, --capture=no don't capture stdout (any stdout output will be | |
99 | printed immediately) |
|
99 | printed immediately) | |
100 |
|
100 | |||
|
101 | Performance tests | |||
|
102 | ^^^^^^^^^^^^^^^^^ | |||
|
103 | ||||
|
104 | A number of performance tests are present in the test suite, but they are | |||
|
105 | not run in a standard test run. These tests are useful to | |||
|
106 | evaluate the impact of certain code changes with respect to performance. | |||
|
107 | ||||
|
108 | To run these tests:: | |||
|
109 | ||||
|
110 | env TEST_PERFORMANCE=1 py.test kallithea/tests/performance | |||
|
111 | ||||
101 |
|
112 | |||
102 | Contribution guidelines |
|
113 | Contribution guidelines | |
103 | ----------------------- |
|
114 | ----------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now