From b3987bfb0840ede0aeab6310134f83ac5f7a082e Mon Sep 17 00:00:00 2001 From: German Date: Wed, 19 Jul 2023 13:34:41 +0200 Subject: [PATCH] Adding unit tests --- tests/test_plotting.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/test_plotting.py b/tests/test_plotting.py index e020291a68..c78b8feb39 100644 --- a/tests/test_plotting.py +++ b/tests/test_plotting.py @@ -570,3 +570,29 @@ def test_vsel_iterable(mapdl, make_block): assert np.allclose( mapdl.vsel("S", "volu", "", [1, 2, 4], "", ""), np.array([1, 2, 4]) ) + + +def test_WithInterativePlotting(mapdl, make_block): + mapdl.eplot(vtk=False) + jobname = mapdl.jobname.upper() + + def filtering(file_name): + file_name = file_name.upper() + if file_name.startswith(jobname) and file_name.endswith(".PNG"): + return True + else: + return False + + list_files = sorted([each for each in mapdl.list_files() if filtering(each)]) + last_png = list_files[0] + + if mapdl.is_local: + last_png = os.path.join(mapdl.directory, last_png) + else: + mapdl.download(last_png) + + # the file size will be 3kb if the image is empty. + assert os.path.getsize(last_png) // 1024 > 4 # kbs + + # cleaning + os.remove(last_png)