Commit Graph

21260 Commits

Author SHA1 Message Date
Gregory Szorc
fe13f7598d run-tests: generate timeout result in Test.run() 2014-04-19 20:48:16 -07:00
Gregory Szorc
3573cbd388 run-tests: add skip processing to Test 2014-04-19 20:47:14 -07:00
Gregory Szorc
d792278ce6 run-tests: move fail() into Test
The code was changed slightly as part of the migration to make use of
appropriate variables and modern Python conventions.
2014-04-19 20:41:08 -07:00
Gregory Szorc
42a72930a7 run-tests: move success() into Test 2014-04-19 20:35:54 -07:00
Gregory Szorc
8fab6ea01c run-tests: move err path handling to Test 2014-04-19 20:32:38 -07:00
Gregory Szorc
0dcb1a6ed2 run-tests: handle interrupted in Test.run() 2014-04-19 20:27:18 -07:00
Gregory Szorc
ddc2d7190f run-tests: kill daemons during Test.cleanup()
As a safety precaution, we kill daemons in Test.cleanup(). This is
necessary for a subsequent patch that will reraise KeyboardInterrupt
before killdaemons() runs as part of run().
2014-04-19 20:22:32 -07:00
Gregory Szorc
aa0568676a run-tests: capture reference output in Test.__init__
Reference output should be constant and doesn't need to be computed at
test execution time. We calculate it earlier.

This patch is the first in a mini series that will change how the
TestResult object works.
2014-04-19 18:50:40 -07:00
Gregory Szorc
c3bcf32fc2 run-tests: make globmatch a static method of TTest 2014-04-19 16:14:30 -07:00
Gregory Szorc
1b34005cfc run-tests: make rematch a static method of TTest 2014-04-19 16:13:02 -07:00
Gregory Szorc
19099dc4f1 run-tests: make linematch a static method of TTest
linematch only applies to t tests. It makes sense to move everything t
test related to the TTest class.
2014-04-19 16:11:49 -07:00
Gregory Szorc
df67209088 run-tests: finish moving tsttest() into TTest 2014-04-19 15:37:50 -07:00
Gregory Szorc
044e5b3e56 run-tests: move t test execution from tsttest() to TTest.run()
After this patch, tsttest() only contains output/result processing.
2014-04-19 15:28:31 -07:00
Gregory Szorc
21e213cf15 run-tests: move t test parsing into its own function
Test parsing is somewhat complicated. This patch extracts it into its
own function.

The impetus of this patch is folding tsttest() into the TTest class.
Subsequent patches will continue this work until tsttest() no longer
exists.
2014-04-19 15:19:28 -07:00
Gregory Szorc
4018f371bc run-tests: roll pytest() into PythonTest._run()
Python was the old runner function. It no longer needs to exist since
the PythonTest class took its job.
2014-04-19 14:54:04 -07:00
Gregory Szorc
bd0b5555d2 run-tests: remove threadtmp in Test.cleanup()
threadtmp is an implementation detail. We move the cleanup of this
directory to Test.cleanup() and make the variable internal. The
cleanup function will eventually disappear into unittest machinery.
2014-04-19 14:51:43 -07:00
Gregory Szorc
5b6c781b5d run-tests: allow Test.run() to run multiple times
Test.run() can now be executed multiple times on the same Test instance.
This feature is currently unused and there are no plans to implement it.
The main reason for this work was to refactor testtmp, replacements, and
env to be run-time specific as opposed to Test instance specific.
2014-04-19 14:47:34 -07:00
Gregory Szorc
d9fcd5b2f9 run-tests: capture reference output in TestResult class 2014-04-19 14:09:46 -07:00
Gregory Szorc
c1c96a878a run-tests: give TestResult a skipped attribute 2014-04-19 14:01:18 -07:00
Gregory Szorc
d1e8b83b37 run-tests: pass TestResult into run() 2014-04-19 18:31:22 -07:00
Gregory Szorc
ce51eb2ab0 run-tests: capture execution results in a TestResult class
Some implementation details of test execution still live outside of
Test. These include determining what a result means and cleaning up
after the test.

To move to the world where more of this logic can live inside Test or a
derived object, the logic for test execution needs to be refactored.
Specifically, exception trapping and opportunities for result processing
need to be moved into Test.

This patch starts the process by establishing a TestResult class for
holding the results of a test execution. In order to actually use this
class, exception trapping and execution time recording needed to be
moved into Test.run().
2014-04-19 13:50:25 -07:00
Gregory Szorc
03c657bc26 run-tests: clean up temp directory variables
testtmp is an implementation detail. It didn't need to be exposed to the
world.

threadtmp is derived from count. It is now created as part of the
constructor and mostly hidden from the outside world.
2014-04-19 13:29:26 -07:00
Gregory Szorc
b3a4d844b0 run-tests: move env into Test
Environment variables are an implementation detail of how tests are
executed. This patch moves environment variable logic into Test and
completely hides it from the outside.

With this patch, a Test can be executed with two lines: init + run().
Tests are still single-use and take a more arguments to the constructor
than likely necessary. These will get addressed in subsequent patches.
2014-04-19 13:26:12 -07:00
Gregory Szorc
d49f5e6aff run-tests: move killdaemons into Test.run()
killdaemons() was the only part of runone() looking at env variables. We
move killdaemons() into Test.run() to enable us to fully move env into
Test.
2014-04-19 13:22:52 -07:00
Gregory Szorc
f33e67ce74 run-tests: move replacements and port management into Test
replacements and ports are really implementation details of a Test. They
have been moved to instance variables.
2014-04-19 13:18:55 -07:00
Gregory Szorc
4a6575aeb5 run-tests: move createhgrc() call into Test.run()
createhgrc() is an implementation detail of how tests are run. It makes
sense to move it into Test.run().

Note that this will cause the test execution time to include the
creation of hgrc. The author does not believe this is a significant
change worth worrying about.
2014-04-19 13:11:49 -07:00
Gregory Szorc
c8d17d56b0 run-tests: move createenv() into Test
createenv() is consulting lots of test-specific variables. It makes
sense to attach it to the Test class.
2014-04-19 13:07:05 -07:00
Gregory Szorc
baae441146 run-tests: move replacements generation into Test
The API is a bit funky. Things will look better once all state is
captured in Test.
2014-04-19 13:03:24 -07:00
Gregory Szorc
37bc48e832 run-tests: move testtmp into Test class
This patch starts the process of moving test-specific variables into the
Test class. The ultimate goal is to be able to instantiate a Test with
minimal arguments and to call run() on it without too much thinking.
This will make it much easier to run tests from other contexts. It will
also enable things like running a test multiple times.
2014-04-19 12:54:09 -07:00
Gregory Szorc
b01959b720 run-tests: create classes for representing tests
Currently, the state for an individual test is scattered across a number
of functions and variables. This patch begins a process of isolating a
single test's state into instances of a class. It does this by
establishing a new Test base class and child classes for Python tests
and T tests. The class currently has a run() API that proxies into the
existing "runner" functions. Upcoming patches will move the logic for
each test type into the class.
2014-04-19 12:26:34 -07:00
Pierre-Yves David
0c7ef71682 revsetbenchmark: add author(mpm) or author(lmoscovicz) to the canonical list
This matters as `author(mpm)` have a lot of matches evenly split in the repo,
while `author(lmoscoviz)` have less match (and later). This changes the execution
path of the "or" operator a lot.
2014-04-30 18:40:20 -07:00
Matt Mackall
89a3b43f20 filterpyflakes: filter WindowsError unconditionally 2014-05-13 19:29:45 -05:00
Matt Mackall
88809bfcbd filterpyflakes: make memoryview filtering unconditional 2014-05-13 19:22:40 -05:00
Matt Mackall
1c61c176de py3kcompat: drop unused export 2014-05-13 15:22:36 -05:00
Gregory Szorc
8fb8b32a82 py3kcompat: don't convert os.environ to bytes
os.environ accepts str not bytes. Assigning bytes will result in a
run-time error.
2014-05-10 15:22:04 -07:00
Gregory Szorc
093c1fe1ab demandimport: pass proper level to __import__ in Python 3
demandimport was failing in Python 3 with a ValueError because
__import__'s level=-1 has gone away (-1 means to try both relative
and absolute imports and relative imports don't exist in Python 3).

With this patch, demandimport still doesn't work in Python 3 (it
fails when importing a non-package module).
2014-05-10 14:57:25 -07:00
Pierre-Yves David
0554727504 help: suggest keyword search when no topic is found
When `hg help foobar` fails, it now suggests using `hg help --keyword foobar`
instead of printing a full page of basic commands.

This should greatly increases discoverability of the `hg help --keyword`
argument.
2014-04-16 19:55:40 -04:00
Pierre-Yves David
1ccd34d69c help: provide a more helpful message when no keyword are matched
Before this changeset, when no topic were matching the provided keyword ( in
command such as `hg help --keyword babar`) the output was empty. This is
confusing and unhelpful for new users seeking assistance in the help.

We now display:

  $ hg help --keyword babar
  abort: no matches
  (try "hg help" for a list of topics)

This send users in a new direction where they may find what they are looking for.
2014-04-16 20:01:03 -04:00
Pierre-Yves David
3e36aa9f14 revsetbenchmark: use optparse to retrieve argument
We need more flexibility. For example we'll want to run the benchmark on other
repository.
2014-04-29 11:40:42 -07:00
Pierre-Yves David
5909fe016c revsetbenchmark: add a usage message when no arguments are passed
This increase the odd someone who didn't wrote will it find out how to use this
script.
2014-04-25 13:35:31 -07:00
Pierre-Yves David
939d348711 revsetbenchmark: add ::tip and draft() to the canonical list
The want to test element on different side of the iterators.
2014-04-29 19:15:36 -07:00
Pierre-Yves David
0a422cd2f2 revset: cosmetic changes in spanset range comparison
We use the python syntax for range comparison: `a < x < c`. This is shorter,
more readable and less error prone. This comparison escaped the cleanup make in
166d6dde9310
2014-04-28 15:14:11 -07:00
Pierre-Yves David
f9553b0f97 revset: drop spanset._contained
All its users inlined it for performance reasons.
(See fcccbf073394 and 166d6dde9310)
2014-04-25 23:38:24 -07:00
Pierre-Yves David
02a943dbb1 patchbomb: includes series information in the header
We includes information about the series being patch bombed in all email. Two
new headers are added:

* X-Mercurial-Series-Index: index of the patches in the series (starts at 1)
* X-Mercurial-Series-Total: The total number of patches in the series

This information is available in the email subject line, but having them
formalized in the header will helps automated tools to process patches send with
modern mercurial.
2014-05-05 22:47:14 -07:00
Matt Mackall
8f271ab8db pager: add attend-<command> option
This lets users override attend settings locally on a command
granularity.
2014-05-09 13:32:56 -05:00
Matt Mackall
9f887e4452 pager: variable reorder 2014-05-09 13:10:23 -05:00
Matt Mackall
5c5576136a pager: break auto out of command check loop 2014-05-09 13:07:50 -05:00
Matt Mackall
e855b86a3a pager: break always out of command check loop 2014-05-09 13:05:52 -05:00
Matt Mackall
911703535d pager: break pager invocation out of command check loop 2014-05-09 12:58:53 -05:00
Matt Mackall
57d2c51227 tests: fix test failure on vfat
It can't handle filenames with spaces. We don't have a good hghave
test for this, so we wrap it with unix-permissions.
2014-05-08 11:11:27 -05:00