Files
edx-platform/common/test/utils.py
Bill DeRusha 973314de7b Add basic elasticsearch search for teams
TNL-3014

Add tests for search

Add text_search to TeamsListView

Add reindex command line tool for course teams

Add Search Pagination and update comments

Move paginate_search_results to common library
2015-08-24 09:22:06 -04:00

27 lines
543 B
Python

"""
General testing utilities.
"""
import sys
from contextlib import contextmanager
@contextmanager
def nostderr():
"""
ContextManager to suppress stderr messages
http://stackoverflow.com/a/1810086/882918
"""
savestderr = sys.stderr
class Devnull(object):
""" /dev/null incarnation as output-stream-like object """
def write(self, _):
""" Write method - just does nothing"""
pass
sys.stderr = Devnull()
try:
yield
finally:
sys.stderr = savestderr