Commit Graph

19 Commits

Author SHA1 Message Date
Pulkit Goyal
b4347ea80f py3: make sure commands name are bytes in tests 2017-06-25 08:20:05 +05:30
Yuya Nishihara
3e663dde68 registrar: move cmdutil.command to registrar module (API)
cmdutil.command wasn't a member of the registrar framework only for a
historical reason. Let's make that happen. This patch keeps cmdutil.command
as an alias for extension compatibility.
2016-01-09 23:07:20 +09:00
Bryan O'Sullivan
2579347008 atexit: test failing handlers 2017-04-11 14:54:12 -07:00
Pierre-Yves David
9680f282d3 extensions: fix a debug message when searching for extensions
The "next" value was wrong. When 'hgext.NAME' is not found we now search for
'hgext3rd.NAME'.
2016-09-30 00:25:15 +02:00
Maciej Fijalkowski
44a4e8de4b pypy: fix overspecific test checks
Those tests check a bit too specific message in ImportError/SyntaxError.
Make test-hook and test-bad-extension pass on pypy
2016-04-03 08:26:57 +01:00
Pierre-Yves David
5d3d0e1d77 extensions: also search for extension in the 'hgext3rd' package
Mercurial extensions are not meant to be normal python package/module. Yet the
lack of an official location to install them means that a lot of them actually
install as root level python package, polluting the global Python package
namespace and risking collision with more legit packages. As we recently
discovered, core python actually support namespace package. A way for multiples
distinct "distribution" to share a common top level package without fear of
installation headache. (Namespace package allow submodule installed in different
location (of the 'sys.path') to be imported properly. So we are fine as long as
extension includes a proper 'hgext3rd.__init__.py' to declare the namespace
package.)

Therefore we introduce a 'hgext3rd' namespace packages and search for extension
in it. We'll then recommend third extensions to install themselves in it.
Strictly speaking we could just get third party extensions to install in 'hgext'
as it is also a namespace package. However, this would make the integration of
formerly third party extensions in the main distribution more complicated as the third
party install would overwrite the file from the main install. Moreover, having an
explicit split between third party and core extensions seems like a good idea.

The name 'hgext3rd' have been picked because it is short and seems explicit enough.
Other alternative I could think of where:

- hgextcontrib
- hgextother
- hgextunofficial
2016-03-11 10:30:08 +00:00
Danek Duvall
213f203c87 tests: Solaris grep doesn't add a trailing newline when it's missing
The bad-extension tests emits a list of not-loaded extensions, and pipes
that output through grep.  On Solaris, the test-output gets "(no-eol)"
appended because although the message has no trailing newline, GNU grep
adds it.  If we simply add the newline to the message, the problem goes
away for both versions of grep.
2016-03-02 15:01:41 -08:00
Jun Wu
6ee6b437f3 extensions: add notloaded method to return extensions failed to load
Before this patch, there is no easy way to detect if there are extensions
failed to load. While this is okay for most situations, chgserver is designed
to preload all extensions specified in config and does need the information.
This patch adds extensions.notloaded() to return names of extensions failed
to load.
2016-02-10 16:59:34 +00:00
Simon Farnsworth
440b97f84b tests: confirm that a badly documented extension doesn't cause a crash
An external extension whose docstring doesn't conform to Mercurial standards
used to cause crashes. Test that we omit such extensions when you do a
keyword search.
2016-02-12 06:25:05 -08:00
Bryan O'Sullivan
d17fc62ed2 test-bad-extension: account for PyPy/CPython error difference 2015-12-23 16:22:20 -08:00
timeless@mozdev.org
36e75d4956 test-bad-extension: reduce dependencies on other things
test-bad-extension would jitter if the format of the first line
of hg help changed, which isn't relevant to its goal.
2015-09-10 19:45:46 -04:00
Yuya Nishihara
8c4e6f9099 extensions: show traceback on load failure if --traceback flag is set
Before this patch, there was no handy way to investigate the reason why
extension couldn't be loaded.

If ui.debug is set, tracebacks of both "hgext.foo" and "foo" are displayed
because the first ImportError could occur at very deep dependency module.
2015-03-30 16:23:35 +09:00
Yuya Nishihara
ed7051c6c7 tests: write hgrc of more than two lines by using shell heredoc
Here document should be readable than repeating echo commands.
2014-11-04 23:41:46 +09:00
Martin Geisler
58a533fee9 help: add -c/--command flag to only show command help (issue2799) 2011-05-10 14:42:53 +02:00
Henri Wiechers
7134ed3f0f help: add -e/--extension switch to display extension help text 2010-01-20 20:24:20 +02:00
Mads Kiilerich
3174ff376b tests: remove redundant globs
Many globs now just match $TESTTMP and is no longer needed.
2010-10-08 22:36:10 -05:00
Brodie Rao
b5fe0d906e tests: add glob matching for unified tests
This adds a " (glob)" marker that works like a simpler version of
(re): "*" is converted to ".*", and "?" is converted to ".".

Both special characters can be escaped using "\", and the backslash
itself can be escaped as well.

Other glob-style syntax, like "**", "[chars]", or "[!chars]", isn't
supported.
2010-09-22 16:06:02 -05:00
Brodie Rao
7d7d96bd74 tests: require regexes in unified tests to be marked with " (re)"
Consider this test:

  $ hg glog --template '{rev}:{node|short} "{desc}"\n'
  @  2:20c4f79fd7ac "3"
  |
  | o  1:38f24201dcab "2"
  |/
  o  0:2a18120dc1c9 "1"

Because each line beginning with "|" can be compiled as a regular
expression (equivalent to ".*|"), they will match any output.

Similarly:

  $ echo foo


The blank output line can be compiled as a regular expression and will
also match any output.

With this patch, none of the above output lines will be matched as
regular expressions. A line must end in " (re)" in order to be matched
as one.

Lines are still matched literally first, so the following will pass:

  $ echo 'foo (re)'
  foo (re)
2010-09-22 16:06:00 -05:00
Martin Geisler
801decc13d tests: unify test-bad-extension 2010-08-14 02:35:44 +02:00