From 1e2c17a35057abf81395b381e290ccb07c09bb38 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 4 Jul 2024 12:41:50 +0200 Subject: [PATCH] tdf#116412: Add unittest Change-Id: Iab051c91900768a3bf3f26b6de3b443dc18a6928 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169990 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- pyuno/Module_pyuno.mk | 1 + pyuno/PythonTest_pyuno_pytests_testbz2.mk | 16 ++++++++++++++++ pyuno/qa/pytests/testbz2.py | 14 ++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 pyuno/PythonTest_pyuno_pytests_testbz2.mk create mode 100644 pyuno/qa/pytests/testbz2.py diff --git a/pyuno/Module_pyuno.mk b/pyuno/Module_pyuno.mk index 890b9fc4aa9e..fac159e2ced3 100644 --- a/pyuno/Module_pyuno.mk +++ b/pyuno/Module_pyuno.mk @@ -48,6 +48,7 @@ endif # SYSTEM_PYTHON $(eval $(call gb_Module_add_check_targets,pyuno, \ PythonTest_pyuno_pytests_testssl \ + PythonTest_pyuno_pytests_testbz2 \ )) $(eval $(call gb_Module_add_subsequentcheck_targets,pyuno, \ diff --git a/pyuno/PythonTest_pyuno_pytests_testbz2.mk b/pyuno/PythonTest_pyuno_pytests_testbz2.mk new file mode 100644 index 000000000000..0f881068c541 --- /dev/null +++ b/pyuno/PythonTest_pyuno_pytests_testbz2.mk @@ -0,0 +1,16 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_PythonTest_PythonTest,pyuno_pytests_testbz2)) + +$(eval $(call gb_PythonTest_add_modules,pyuno_pytests_testbz2,$(SRCDIR)/pyuno/qa/pytests,\ + testbz2 \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/pyuno/qa/pytests/testbz2.py b/pyuno/qa/pytests/testbz2.py new file mode 100644 index 000000000000..12a44e14bb09 --- /dev/null +++ b/pyuno/qa/pytests/testbz2.py @@ -0,0 +1,14 @@ +import os +import unittest + +# tdf#116412: make sure importing bz2 works on all platforms +class BZ2Test(unittest.TestCase): + def test_bz2_import(self): + import bz2 + + # use imported bz2 module for pyflakes + with open(os.devnull, "w") as devnull: + print(str(bz2), file=devnull) + +if __name__ == '__main__': + unittest.main()