@@ -22,8 +22,25 @@ def test_stats(self, capfd):
2222 with tiledb .from_numpy (path , np .arange (10 )) as T :
2323 pass
2424
25- # basic output check for read stats
25+ # check that Writer stats are printed
26+ tiledb .stats_dump ()
27+
28+ if tiledb .libtiledb .version () >= (2 , 27 ):
29+ assert_captured (capfd , "Context.Query.Writer" )
30+ else :
31+ assert_captured (capfd , "Context.StorageManager.Query.Writer" )
32+
33+ # check that Writer stats are not printed because of reset
2634 tiledb .stats_reset ()
35+ tiledb .stats_dump ()
36+
37+ if tiledb .libtiledb .version () >= (2 , 27 ):
38+ assert_captured (capfd , "Context.Query.Writer" , expected = False )
39+ else :
40+ assert_captured (
41+ capfd , "Context.StorageManager.Query.Writer" , expected = False
42+ )
43+
2744 with tiledb .open (path ) as T :
2845 tiledb .stats_enable ()
2946 assert_array_equal (T , np .arange (10 ))
@@ -32,6 +49,13 @@ def test_stats(self, capfd):
3249 tiledb .stats_dump ()
3350 assert_captured (capfd , "TileDB Embedded Version:" )
3451
52+ # check that Reader stats are printed
53+ tiledb .stats_dump ()
54+ if tiledb .libtiledb .version () >= (2 , 27 ):
55+ assert_captured (capfd , "Context.Query.Reader" )
56+ else :
57+ assert_captured (capfd , "Context.StorageManager.Query.Reader" )
58+
3559 # test string version
3660 stats_v = tiledb .stats_dump (print_out = False )
3761 if tiledb .libtiledb .version () < (2 , 3 ):
@@ -51,6 +75,16 @@ def test_stats(self, capfd):
5175 else :
5276 self .assertTrue ("==== READ ====" in stats_quiet )
5377
78+ # check that Writer stats are not printed because of reset
79+ tiledb .stats_reset ()
80+ tiledb .stats_dump ()
81+ if tiledb .libtiledb .version () >= (2 , 27 ):
82+ assert_captured (capfd , "Context.Query.Reader" , expected = False )
83+ else :
84+ assert_captured (
85+ capfd , "Context.StorageManager.Query.Reader" , expected = False
86+ )
87+
5488 def test_stats_include_python_json (self ):
5589 tiledb .stats_enable ()
5690
0 commit comments