Skip to content

Commit

Permalink
Fix: Suppress expected warnings to avoid a cluttered test output
Browse files Browse the repository at this point in the history
  • Loading branch information
onefloid authored and MariusWirtz committed Nov 12, 2024
1 parent 6cbd53f commit 398105b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Tests/DimensionService_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import configparser
import unittest
import warnings
from pathlib import Path

from TM1py.Objects import Dimension, Hierarchy, Element
Expand Down Expand Up @@ -179,12 +180,17 @@ def test_get_number_of_dimensions(self):

def test_execute_mdx(self):
mdx = "{TM1SubsetAll(" + self.dimension_name + ")}"
elements = self.tm1.dimensions.execute_mdx(self.dimension_name, mdx)
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
elements = self.tm1.dimensions.execute_mdx(self.dimension_name, mdx)
self.assertEqual(len(elements), 1001)

mdx = "{ Tm1FilterByLevel ( {TM1SubsetAll(" + self.dimension_name + ")}, 0) }"
elements = self.tm1.dimensions.execute_mdx(self.dimension_name, mdx)
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
elements = self.tm1.dimensions.execute_mdx(self.dimension_name, mdx)
self.assertEqual(len(elements), 1000)

for element in elements:
self.assertTrue(element.startswith("Element"))

Expand Down
4 changes: 4 additions & 0 deletions Tests/MonitoringService_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import configparser
import unittest
import warnings
from pathlib import Path

from TM1py.Services import TM1Service
Expand All @@ -20,6 +21,9 @@ def setUpClass(cls):
cls.config = configparser.ConfigParser()
cls.config.read(Path(__file__).parent.joinpath('config.ini'))
cls.tm1 = TM1Service(**cls.config['tm1srv01'])
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
cls.tm1.monitoring

@skip_if_version_higher_or_equal_than(version="12.0.0")
def test_get_threads(self):
Expand Down

0 comments on commit 398105b

Please sign in to comment.