From 33a51a9bf9268e9cc4e3dd5d9d0b714bef486c08 Mon Sep 17 00:00:00 2001 From: Mojtaba <11262163+mojtaba-komeili@users.noreply.github.com> Date: Fri, 17 Feb 2023 10:07:57 -0500 Subject: [PATCH] skip unless mephistor decorator (#4957) --- parlai/utils/testing.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/parlai/utils/testing.py b/parlai/utils/testing.py index 029e9d1e70b..72fdf4bfdc3 100644 --- a/parlai/utils/testing.py +++ b/parlai/utils/testing.py @@ -62,6 +62,14 @@ FAIRSEQ_AVAILABLE = False +try: + import mephisto # noqa: F401 + + MEPHISTO_AVAILABLE = True +except ImportError: + MEPHISTO_AVAILABLE = False + + def is_this_circleci(): """ Return if we are currently running in CircleCI. @@ -130,6 +138,13 @@ def skipUnlessFairseq(testfn, reason='fairseq not installed'): return unittest.skipUnless(FAIRSEQ_AVAILABLE, reason)(testfn) +def skipUnlessMephisto(testfn, reason='mephisto not installed'): + """ + Decorate a test to skip unless mephisto is installed. + """ + return unittest.skipUnless(MEPHISTO_AVAILABLE, reason)(testfn) + + class retry(object): """ Decorator for flaky tests. Test is run up to ntries times, retrying on failure.