Skip to content
Snippets Groups Projects
Commit 0e1cbd3d authored by Matt Mackall's avatar Matt Mackall
Browse files

tests: add repository check for pyflakes test

If this test was run from a tarball with no Mercurial repository, it
would fail because 'hg manifest' didn't work.
parent b9defeeb
No related merge requests found
...@@ -259,6 +259,10 @@ ...@@ -259,6 +259,10 @@
def has_serve(): def has_serve():
return os.name != 'nt' # gross approximation return os.name != 'nt' # gross approximation
def has_test_repo():
t = os.environ["TESTDIR"]
return os.path.isdir(os.path.join(t, "..", ".hg"))
def has_tic(): def has_tic():
try: try:
import curses import curses
...@@ -317,6 +321,7 @@ ...@@ -317,6 +321,7 @@
"svn-bindings": (has_svn_bindings, "subversion python bindings"), "svn-bindings": (has_svn_bindings, "subversion python bindings"),
"symlink": (has_symlink, "symbolic links"), "symlink": (has_symlink, "symbolic links"),
"system-sh": (has_system_sh, "system() uses sh"), "system-sh": (has_system_sh, "system() uses sh"),
"test-repo": (has_test_repo, "running tests from repository"),
"tic": (has_tic, "terminfo compiler and curses module"), "tic": (has_tic, "terminfo compiler and curses module"),
"tla": (has_tla, "GNU Arch tla client"), "tla": (has_tla, "GNU Arch tla client"),
"unix-permissions": (has_unix_permissions, "unix-style permissions"), "unix-permissions": (has_unix_permissions, "unix-style permissions"),
......
$ "$TESTDIR/hghave" pyflakes || exit 80 #if test-repo pyflakes
$ cd "`dirname "$TESTDIR"`" $ cd "`dirname "$TESTDIR"`"
run pyflakes on all tracked files ending in .py or without a file ending run pyflakes on all tracked files ending in .py or without a file ending
(skipping binary file random-seed) (skipping binary file random-seed)
...@@ -2,7 +3,8 @@ ...@@ -2,7 +3,8 @@
$ cd "`dirname "$TESTDIR"`" $ cd "`dirname "$TESTDIR"`"
run pyflakes on all tracked files ending in .py or without a file ending run pyflakes on all tracked files ending in .py or without a file ending
(skipping binary file random-seed) (skipping binary file random-seed)
$ hg manifest 2>/dev/null | egrep "\.py$|^[^.]*$" | grep -v /random_seed$ \ $ hg manifest 2>/dev/null | egrep "\.py$|^[^.]*$" | grep -v /random_seed$ \
> | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py" > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
contrib/win32/hgwebdir_wsgi.py:*: 'win32traceutil' imported but unused (glob) contrib/win32/hgwebdir_wsgi.py:*: 'win32traceutil' imported but unused (glob)
...@@ -16,4 +18,4 @@ ...@@ -16,4 +18,4 @@
tests/hghave.py:*: 'ssl' imported but unused (glob) tests/hghave.py:*: 'ssl' imported but unused (glob)
contrib/win32/hgwebdir_wsgi.py:93: 'from isapi.install import *' used; unable to detect undefined names (glob) contrib/win32/hgwebdir_wsgi.py:93: 'from isapi.install import *' used; unable to detect undefined names (glob)
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment