[PATCH 2 of 2] tests: make test-atomictempfile use absolute_import
Yuya Nishihara
yuya at tcha.org
Sat Apr 16 09:40:28 EDT 2016
On Sat, 16 Apr 2016 13:44:06 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1460791173 -19800
> # Sat Apr 16 12:49:33 2016 +0530
> # Node ID b9ab069066106bcaf834d33ce2434a1d45e5cac5
> # Parent 6276e8c283b5071663dcc04087c1edaccddb9ca8
> tests: make test-atomictempfile use absolute_import
>
> Direct importing silenttestrunner was causing an error that stlib import is
> followed by local import and importing it directly after unittest will make
> it lexicographically unsorted.
>
> diff -r 6276e8c283b5 -r b9ab06906610 tests/test-atomictempfile.py
> --- a/tests/test-atomictempfile.py Sat Apr 16 12:41:58 2016 +0530
> +++ b/tests/test-atomictempfile.py Sat Apr 16 12:49:33 2016 +0530
> @@ -1,9 +1,16 @@
> +from __future__ import absolute_import
> +
> +import glob
> import os
> -import glob
> import unittest
> -import silenttestrunner
>
> -from mercurial.util import atomictempfile
> +from . import silenttestrunner
Did you run test-atomictempfile.py ?
You can't import silenttestrunner from . because
a) tests/ isn't a Python package (no __init__.py)
b) and test-atomictempfile.py doesn't comply with Python module naming
(contains dash)
Maybe we have to fix import-checker.py.
More information about the Mercurial-devel
mailing list