def falls_back_to_defaultlocale_when_preferredencoding_is_None(self): if not six.PY3: skip() with patch('invoke.runners.locale') as fake_locale: fake_locale.getdefaultlocale.return_value = (None, None) fake_locale.getpreferredencoding.return_value = 'FALLBACK' eq_(self._runner().default_encoding(), 'FALLBACK')
def bool_implies_default_False_not_None(self): # Right now, parsing a bool flag not given results in None # TODO: may want more nuance here -- False when a --no-XXX flag is # given, True if --XXX, None if not seen? # Only makes sense if we add automatic --no-XXX stuff (think # ./configure) skip()
def stdin_mirroring_isnt_cpu_heavy(self): "stdin mirroring isn't CPU-heavy" # CPU measurement under PyPy is...rather different. NBD. if PYPY: skip() with assert_cpu_usage(lt=5.0): run("python -u busywork.py 10", pty=True, hide=True)
def falls_back_to_defaultlocale_when_preferredencoding_is_None(self): if PY2: skip() with patch('invoke.runners.locale') as fake_locale: fake_locale.getdefaultlocale.return_value = (None, None) fake_locale.getpreferredencoding.return_value = 'FALLBACK' eq_(self._runner().default_encoding(), 'FALLBACK')
def isnt_cpu_heavy(self): "stdin mirroring isn't CPU-heavy" # CPU measurement under PyPy is...rather different. NBD. if PYPY: skip() with assert_cpu_usage(lt=5.0): run("python -u busywork.py 10", pty=True, hide=True)
def isnt_cpu_heavy(self): "stdin mirroring isn't CPU-heavy" # CPU measurement under PyPy is...rather different. NBD. if PYPY: skip() # Python 3.5 has been seen using up to ~6.0s CPU time under Travis with assert_cpu_usage(lt=7.0): run("python -u busywork.py 10", pty=True, hide=True)
def invocable_via_python_dash_m(self): # TODO: replace with pytest marker after pytest port if sys.version_info < (2, 7): skip() _output_eq( "python -m invoke print_name --name mainline", "mainline\n", )
def invocable_via_python_dash_m(self): # TODO: replace with pytest marker after pytest port if sys.version_info < (2, 7): skip() _output_eq( "python -m invoke print-name --name mainline", "mainline\n", )
def echo_hides_extra_sudo_flags(self): skip() # see TODO in sudo() re: clean output display config = Config(overrides={'runner': _Dummy}) Context(config=config).sudo('nope', echo=True) output = sys.stdout.getvalue() sys.__stderr__.write(repr(output) + "\n") ok_("-S" not in output) ok_(Context().sudo.prompt not in output) ok_("sudo nope" in output)
def base_case(self): # NOTE: Assumes a user whose password is 'mypass' has been created # & added to passworded (not passwordless) sudo configuration; and # that this user is the one running the test suite. Only for # running on Travis, basically. if not os.environ.get('TRAVIS', False): skip() config = Config(overrides={'sudo': {'password': '******'}}) result = Context(config=config).sudo('whoami', hide=True) eq_(result.stdout.strip(), 'root')
def both_technically_okay(self): skip() # see TODO below _expect_actions(self, # TODO: display a 'warning' state noting that your # version outpaces your changelog despite your # changelog having no unreleased stuff in it. Still # "Okay" (no action needed), not an error per se, but # still "strange". Changelog.OKAY, VersionFile.OKAY, )
def both_technically_okay(self): skip() # see TODO below _expect_actions( self, # TODO: display a 'warning' state noting that your # version outpaces your changelog despite your # changelog having no unreleased stuff in it. Still # "Okay" (no action needed), not an error per se, but # still "strange". Changelog.OKAY, VersionFile.OKAY, )
def manual_threading_works_okay(self): # TODO: needs https://github.com/pyinvoke/invoke/issues/438 fixed # before it will reliably pass skip() # Kind of silly but a nice base case for "how would someone thread this # stuff; and are there any bizarre gotchas lurking in default # config/context/connection state?" # Specifically, cut up the local (usually 100k's long) words dict into # per-thread chunks, then read those chunks via shell command, as a # crummy "make sure each thread isn't polluting things like stored # stdout" sanity test queue = Queue() # TODO: skip test on Windows or find suitable alternative file with codecs.open(_words, encoding='utf-8') as fd: data = [x.strip() for x in fd.readlines()] threads = [] num_words = len(data) chunksize = len(data) / len(self.cxns) # will be an int, which is fine for i, cxn in enumerate(self.cxns): start = i * chunksize end = max([start + chunksize, num_words]) chunk = data[start:end] kwargs = dict( queue=queue, cxn=cxn, start=start, num_words=num_words, count=len(chunk), expected=chunk, ) thread = ExceptionHandlingThread(target=_worker, kwargs=kwargs) threads.append(thread) for t in threads: t.start() for t in threads: t.join(5) # Kinda slow, but hey, maybe the test runner is hot while not queue.empty(): cxn, result, expected = queue.get(block=False) for resultword, expectedword in zip_longest(result, expected): err = u"({2!r}, {3!r}->{4!r}) {0!r} != {1!r}".format( resultword, expectedword, cxn, expected[0], expected[-1], ) assert resultword == expectedword, err
def inner(*args, **kwargs): if getattr(sys.stdout, 'encoding', None) == 'UTF-8': return f(*args, **kwargs) # TODO: could remove this so they show green, but figure yellow is more # appropriate skip()
def wrapper(*args, **kwargs): if WINDOWS: skip() return fn(*args, **kwargs)
def sets_arg_kind(self): skip()
def iter(self): "__iter__" skip()
def honors_kwarg(self): skip()
def load_failure(self): skip()
def keys(self): skip()
def explicit_unstable_releases_still_eat_their_issues(self): # I.e. an 0.x.y releases using explicit issue listings, works # correctly - the explicitly listed issues don't appear in nearby # implicit releases. skip()
def semver_double_ended_specs_work_when_more_than_two_major_versions(self): skip()
def can_disable_default_pin_to_latest_major_version(self): skip()
def no_dedupe(self): skip()
def list_(self): skip()
def task_has_h_shortflag_throws_error(self): # def mytask(c, height): # inv mytask -h skip()
def warning_only_fires_once(self): # I.e. if implementation checks pty-ness >1 time, only one warning # is emitted. This is kinda implementation-specific, but... skip()
def adds_collection_as_subcollection_of_self(self): skip()
def should_show_core_usage_on_core_failures(self): skip()
def finds_subcollection_tasks_by_dotted_name(self): skip()
def contents_of_dicts_are_distinct(self): skip()
def honors_subcollection_aliases(self): skip()
def values(self): skip()
def is_None_for_custom_command_exits(self): # TODO: when we implement 'exitcodes 1 and 2 are actually OK' skip()
def should_show_context_usage_on_context_failures(self): skip()
def is_aliased_to_dunder_getitem(self): "is aliased to __getitem__" skip()
def prompt_value_is_properly_shell_escaped(self): # I.e. setting it to "here's johnny!" doesn't explode. # NOTE: possibly best to tie into issue #2 skip()
def kind_to_placeholder_map(self): # str=STRING, int=INT, etc etc skip()
def KeyboardInterrupt_on_stdin_doesnt_flake(self): # E.g. inv test => Ctrl-C halfway => shouldn't get buffer API errors skip()
def returns_copy_of_self(self): skip()
def returns_FIONREAD_result_when_stream_is_a_tty(self): skip()
def returns_1_on_windows(self): skip()
def non_stupid_OSErrors_get_captured(self): # Somehow trigger an OSError saying "Input/output error" within # pexpect.spawn().interact() & assert it is in result.exception skip()
def with_post_tasks(self): skip()
def honors_subcollection_default_tasks_on_subcollection_name(self): skip()