From 9cdd35e625f705d3b644f2f17af7c9cb44c24446 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 16 Sep 2020 11:28:38 -0400 Subject: [PATCH] Make sure Python tests run unbuffered so PyLammps works --- unittest/python/CMakeLists.txt | 4 ++-- unittest/python/python-pylammps.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/unittest/python/CMakeLists.txt b/unittest/python/CMakeLists.txt index dd9d3a54c5..6082eb99b1 100644 --- a/unittest/python/CMakeLists.txt +++ b/unittest/python/CMakeLists.txt @@ -32,9 +32,9 @@ if (Python_EXECUTABLE) find_package_handle_standard_args(COVERAGE DEFAULT_MSG COVERAGE_BINARY) if(COVERAGE_FOUND) - set(PYTHON_TEST_RUNNER ${Python_EXECUTABLE} ${COVERAGE_BINARY} run --parallel-mode --include=${LAMMPS_PYTHON_DIR}/lammps.py --omit=${LAMMPS_PYTHON_DIR}/install.py) + set(PYTHON_TEST_RUNNER ${Python_EXECUTABLE} -u ${COVERAGE_BINARY} run --parallel-mode --include=${LAMMPS_PYTHON_DIR}/lammps.py --omit=${LAMMPS_PYTHON_DIR}/install.py) else() - set(PYTHON_TEST_RUNNER ${Python_EXECUTABLE}) + set(PYTHON_TEST_RUNNER ${Python_EXECUTABLE} -u) endif() else() set(PYTHON_TEST_RUNNER ${Python_EXECUTABLE}) diff --git a/unittest/python/python-pylammps.py b/unittest/python/python-pylammps.py index 7fb4165ced..9562781dfc 100644 --- a/unittest/python/python-pylammps.py +++ b/unittest/python/python-pylammps.py @@ -44,6 +44,7 @@ class PythonPyLammps(unittest.TestCase): types = [1, 1] self.assertEqual(self.pylmp.lmp.create_atoms(2, id=None, type=types, x=x), 2) + self.assertEqual(self.pylmp.system.natoms, 2) if __name__ == "__main__": unittest.main()