Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
skip unless mephistor decorator (#4957)
Browse files Browse the repository at this point in the history
  • Loading branch information
mojtaba-komeili committed Feb 17, 2023
1 parent 8633e04 commit 33a51a9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions parlai/utils/testing.py
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 33a51a9

Please sign in to comment.