annotate PerfsDb/Tests/Statistics.py @ 205:42e4c00fe7c8 Orthanc-1.5.2

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 18 Jan 2019 19:11:20 +0100
parents 11b7e1fa7aff
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
158
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
1 import json
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
2
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
3 from Test import Test
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
4
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
5 class TestStatistics(Test):
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
6
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
7 def __init__(self, name:str = "Statistics"):
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
8 super().__init__(name)
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
9 self._response = None
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
10
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
11 def test(self):
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
12 self._statistics = self._orthanc.getJson(relativeUrl="statistics")
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
13
166
7d39adee9f88 don't repeat statistics test that is lengthy
am@osimis.io
parents: 158
diff changeset
14 def beforeAll(self):
7d39adee9f88 don't repeat statistics test that is lengthy
am@osimis.io
parents: 158
diff changeset
15 # on large DB, statistics may be very slow so we don't want to repeat it 30 times !
168
am@osimis.io
parents: 167
diff changeset
16 self.repeatCount = int(max(int(self.repeatCount) / 10, 1))
166
7d39adee9f88 don't repeat statistics test that is lengthy
am@osimis.io
parents: 158
diff changeset
17
158
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
18 def afterAll(self):
df1f9946571c perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
am@osimis.io
parents:
diff changeset
19 print("Statistics:" + json.dumps(self._statistics))