[PATCH] tests: fix import-checker relative test on python 2.6

Sean Farley sean at farley.io
Tue Jun 21 02:52:13 EDT 2016


Durham Goode <durham at fb.com> writes:

> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1466491380 25200
> #      Mon Jun 20 23:43:00 2016 -0700
> # Node ID e735bd6f9b4b801538b5958c3cb298bb4934790f
> # Parent  4e6e280e238fa885df9e0e600dc5915a71c8a37a
> tests: fix import-checker relative test on python 2.6
>
> Commit 1f88c0f6ff5a introduced a None check in fromlocal to detect relative
> imports. It assumed the ast returned None for a relative import. This is true
> for Python 2.7, but Python 2.6 actually returns an empty string instead. This
> went unnoticed until cba8bc11ed, which changed the logic around late importers
> and started the import checker test failing in Python 2.6.
>
> The fix is to just check for an empty string as well. I verified this fix by
> running the module import test and verifying that every invocation of
> `fromlocal` that was None in 2.7 was '' in 2.6.

I'm not as strict as Augie, so this seems fine to me (ducks behind
desk).


More information about the Mercurial-devel mailing list