annotate PerfsDb/Tests/Statistics.py @ 166:7d39adee9f88

don't repeat statistics test that is lengthy
author am@osimis.io
date Fri, 31 Aug 2018 10:31:15 +0200
parents df1f9946571c
children 3b1bfbe960c9
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 !
7d39adee9f88 don't repeat statistics test that is lengthy
am@osimis.io
parents: 158
diff changeset
16 self.repeatCount = max(self.repeatCount / 10, 1)
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))