adjust recently added/expanded tests so they skip tests when packages are missing

This commit is contained in:
Axel Kohlmeyer 2020-10-13 15:42:21 -04:00
parent d0ac698a41
commit 8ab5f3c71a
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
2 changed files with 6 additions and 1 deletions

View File

@ -105,7 +105,7 @@ TEST_F(LibraryConfig, style_count)
EXPECT_GT(lammps_style_count(lmp, "dihedral"), 1);
EXPECT_GT(lammps_style_count(lmp, "improper"), 1);
EXPECT_GT(lammps_style_count(lmp, "pair"), 1);
EXPECT_GT(lammps_style_count(lmp, "kspace"), 1);
EXPECT_GE(lammps_style_count(lmp, "kspace"), 0);
EXPECT_GT(lammps_style_count(lmp, "compute"), 1);
EXPECT_GT(lammps_style_count(lmp, "fix"), 1);
EXPECT_GT(lammps_style_count(lmp, "region"), 1);

View File

@ -12,6 +12,7 @@
------------------------------------------------------------------------- */
#include "atom.h"
#include "info.h"
#include "input.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
@ -37,6 +38,7 @@ using ::testing::MatchesRegex;
class PythonPackageTest : public ::testing::Test {
protected:
LAMMPS *lmp;
Info *info;
void SetUp() override
{
@ -47,6 +49,7 @@ protected:
lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_NE(lmp, nullptr);
info = new Info(lmp);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units real");
lmp->input->one("dimension 3");
@ -71,6 +74,7 @@ protected:
TEST_F(PythonPackageTest, python_invoke)
{
if (!info->has_style("command","python")) GTEST_SKIP();
// execute python function from file
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("python printnum file ${input_dir}/func.py");
@ -105,6 +109,7 @@ TEST_F(PythonPackageTest, python_invoke)
TEST_F(PythonPackageTest, python_variable)
{
if (!info->has_style("command","python")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("variable sq python square");
lmp->input->one("variable val index 1.5");