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

Mephisto test skip when there is no Mephisto #4957

Merged
merged 1 commit into from Feb 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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