def test_ignored(self): with TestModule() as m: self.assertFalse(m.loaded) with demandimport.enabled(): with demandimport.ignored(m.name): lm = __import__(m.name, locals={'foo': 'bar'}) self.assertTrue(m.loaded)
""" Some helper functions for the terminal """ import contextlib import termios import logging import getpass import ctypes import select import string import fcntl import sys import os import demandimport with demandimport.ignored('simplejson'): import zxcvbn l = logging.getLogger(__name__) def prompt_yes_or_no(prompt): """ Prompts user for a yes or no """ sys.stderr.write(prompt) sys.stderr.write(' y/n') sys.stderr.flush() ret = None while ret is None: c = wait_for_keypress() if c == 'y': ret = True
""" Some helper functions for the terminal """ import contextlib import termios import logging import getpass import ctypes import select import string import fcntl import sys import os import demandimport with demandimport.ignored('simplejson'): import zxcvbn l = logging.getLogger(__name__) def prompt_yes_or_no(prompt): """ Prompts user for a yes or no """ sys.stderr.write(prompt) sys.stderr.write(' y/n') sys.stderr.flush() ret = None while ret is None: c = wait_for_keypress() if c == 'y': ret = True if c == 'n':