tests/test-check-module-imports.t
author Matt Harbison <matt_harbison@yahoo.com>
Mon, 22 May 2017 21:45:02 -0400
changeset 32677 f840b2621cce
parent 31442 d3a56bb268ee
child 33116 6c113a7dec52
permissions -rw-r--r--
killdaemons: close pid file before killing processes With #serve enabled on Windows, I was getting occasional stacktraces like this: Errored test-hgweb-json.t: Traceback (most recent call last): File "./run-tests.py", line 724, in run self.tearDown() File "./run-tests.py", line 805, in tearDown killdaemons(entry) File "./run-tests.py", line 540, in killdaemons logfn=vlog) File "...\tests\killdaemons.py", line 94, in killdaemons os.unlink(pidfile) WindowsError: [Error 32] The process cannot access the file because it is being used by another process: '...\\hgtests.zmpqj3\\child80\\daemon.pids' Adrian suggested using util.posixfile, which works. However, the 'mercurial' package isn't in sys.path when invoking run-tests.py, and it isn't clear that hacking[1] it in is a good thing (especially for test-run-tests.t, which uses an installation in a temp folder). I tried using ProcessMonitor to figure out what the other process is, but that monitoring slows things down to such a degree that the issue doesn't occur. I was ready to blame the virus scanner, but it happens without that too. Looking at the code, I don't see anything that would have the pid file open. But I was able to get through about 20 full test runs without an issue with this minor change, whereas before it was pretty certain to hit this at least once in two or three runs. [1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-May/097907.html
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23894
f388ceae2250 test-module-imports: use test-repo requirement
Matt Mackall <mpm@selenic.com>
parents: 22947
diff changeset
     1
#require test-repo
f388ceae2250 test-module-imports: use test-repo requirement
Matt Mackall <mpm@selenic.com>
parents: 22947
diff changeset
     2
29219
3c9066ed557c tests: silence test-repo obsolete warning
timeless <timeless@mozdev.org>
parents: 29212
diff changeset
     3
  $ . "$TESTDIR/helpers-testrepo.sh"
20039
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     4
  $ import_checker="$TESTDIR"/../contrib/import-checker.py
23894
f388ceae2250 test-module-imports: use test-repo requirement
Matt Mackall <mpm@selenic.com>
parents: 22947
diff changeset
     5
20039
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     6
  $ cd "$TESTDIR"/..
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     7
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     8
There are a handful of cases here that require renaming a module so it
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     9
doesn't overlap with a stdlib module name. There are also some cycles
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
    10
here that we should still endeavor to fix, and some cycles will be
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
    11
hidden by deduplication algorithm in the cycle detector, so fixing
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
    12
these may expose other cycles.
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
    13
28844
99a2bdad0fda tests: enable import checker for tests/**.py files
Yuya Nishihara <yuya@tcha.org>
parents: 28330
diff changeset
    14
Known-bad files are excluded by -X as some of them would produce unstable
99a2bdad0fda tests: enable import checker for tests/**.py files
Yuya Nishihara <yuya@tcha.org>
parents: 28330
diff changeset
    15
outputs, which should be fixed later.
99a2bdad0fda tests: enable import checker for tests/**.py files
Yuya Nishihara <yuya@tcha.org>
parents: 28330
diff changeset
    16
29234
393aef802535 tests: enable import checker for all python files (including no .py files)
Yuya Nishihara <yuya@tcha.org>
parents: 29219
diff changeset
    17
  $ hg locate 'set:**.py or grep(r"^#!.*?python")' \
28923
531dea16f4f7 tests: run import-checker with tests .t files
timeless <timeless@mozdev.org>
parents: 28844
diff changeset
    18
  > 'tests/**.t' \
29212
8005e0e0eb33 tests: enable import checker for all **.py files
Yuya Nishihara <yuya@tcha.org>
parents: 29208
diff changeset
    19
  > -X contrib/debugshell.py \
30435
b86a448a2965 zstd: vendor python-zstandard 0.5.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29305
diff changeset
    20
  > -X contrib/python-zstandard/ \
29212
8005e0e0eb33 tests: enable import checker for all **.py files
Yuya Nishihara <yuya@tcha.org>
parents: 29208
diff changeset
    21
  > -X contrib/win32/hgwebdir_wsgi.py \
8005e0e0eb33 tests: enable import checker for all **.py files
Yuya Nishihara <yuya@tcha.org>
parents: 29208
diff changeset
    22
  > -X doc/gendoc.py \
8005e0e0eb33 tests: enable import checker for all **.py files
Yuya Nishihara <yuya@tcha.org>
parents: 29208
diff changeset
    23
  > -X doc/hgmanpage.py \
29234
393aef802535 tests: enable import checker for all python files (including no .py files)
Yuya Nishihara <yuya@tcha.org>
parents: 29219
diff changeset
    24
  > -X i18n/posplit \
28844
99a2bdad0fda tests: enable import checker for tests/**.py files
Yuya Nishihara <yuya@tcha.org>
parents: 28330
diff changeset
    25
  > -X tests/test-hgweb-auth.py \
99a2bdad0fda tests: enable import checker for tests/**.py files
Yuya Nishihara <yuya@tcha.org>
parents: 28330
diff changeset
    26
  > -X tests/hypothesishelpers.py \
99a2bdad0fda tests: enable import checker for tests/**.py files
Yuya Nishihara <yuya@tcha.org>
parents: 28330
diff changeset
    27
  > -X tests/test-ctxmanager.py \
99a2bdad0fda tests: enable import checker for tests/**.py files
Yuya Nishihara <yuya@tcha.org>
parents: 28330
diff changeset
    28
  > -X tests/test-lock.py \
99a2bdad0fda tests: enable import checker for tests/**.py files
Yuya Nishihara <yuya@tcha.org>
parents: 28330
diff changeset
    29
  > -X tests/test-verify-repo-operations.py \
28923
531dea16f4f7 tests: run import-checker with tests .t files
timeless <timeless@mozdev.org>
parents: 28844
diff changeset
    30
  > -X tests/test-hook.t \
531dea16f4f7 tests: run import-checker with tests .t files
timeless <timeless@mozdev.org>
parents: 28844
diff changeset
    31
  > -X tests/test-import.t \
31442
d3a56bb268ee import-checkers: split tests of the tool from running it on the source
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30435
diff changeset
    32
  > -X tests/test-imports-checker.t \
28923
531dea16f4f7 tests: run import-checker with tests .t files
timeless <timeless@mozdev.org>
parents: 28844
diff changeset
    33
  > -X tests/test-commit-interactive.t \
531dea16f4f7 tests: run import-checker with tests .t files
timeless <timeless@mozdev.org>
parents: 28844
diff changeset
    34
  > -X tests/test-contrib-check-code.t \
531dea16f4f7 tests: run import-checker with tests .t files
timeless <timeless@mozdev.org>
parents: 28844
diff changeset
    35
  > -X tests/test-extension.t \
531dea16f4f7 tests: run import-checker with tests .t files
timeless <timeless@mozdev.org>
parents: 28844
diff changeset
    36
  > -X tests/test-hghave.t \
531dea16f4f7 tests: run import-checker with tests .t files
timeless <timeless@mozdev.org>
parents: 28844
diff changeset
    37
  > -X tests/test-hgweb-no-path-info.t \
531dea16f4f7 tests: run import-checker with tests .t files
timeless <timeless@mozdev.org>
parents: 28844
diff changeset
    38
  > -X tests/test-hgweb-no-request-uri.t \
531dea16f4f7 tests: run import-checker with tests .t files
timeless <timeless@mozdev.org>
parents: 28844
diff changeset
    39
  > -X tests/test-hgweb-non-interactive.t \
28844
99a2bdad0fda tests: enable import checker for tests/**.py files
Yuya Nishihara <yuya@tcha.org>
parents: 28330
diff changeset
    40
  > | sed 's-\\-/-g' | python "$import_checker" -