Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
hg-git
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
hg-git
Commits
cca56bbe
Commit
cca56bbe
authored
7 years ago
by
Tony Tung
Browse files
Options
Downloads
Patches
Plain Diff
tests: copy hg test infra from hg repo @5cfdf6137af8
parent
bb255eaf
No related branches found
Branches containing commit
Tags
0.8.1
Tags containing commit
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/hghave
+33
-41
33 additions, 41 deletions
tests/hghave
tests/hghave.py
+506
-104
506 additions, 104 deletions
tests/hghave.py
tests/run-tests.py
+341
-236
341 additions, 236 deletions
tests/run-tests.py
with
880 additions
and
381 deletions
tests/hghave
+
33
−
41
View file @
cca56bbe
...
...
@@ -3,4 +3,8 @@
if all features are there, non-zero otherwise. If a feature name is
prefixed with
"
no-
"
, the absence of feature is tested.
"""
from
__future__
import
absolute_import
,
print_function
import
hghave
import
optparse
...
...
@@ -6,2 +10,3 @@
import
optparse
import
os
import
sys
...
...
@@ -7,6 +12,5 @@
import
sys
import
hghave
checks
=
hghave
.
checks
def
list_features
():
...
...
@@ -9,6 +13,6 @@
checks
=
hghave
.
checks
def
list_features
():
for
name
,
feature
in
checks
.
iter
items
():
for
name
,
feature
in
sorted
(
checks
.
items
()
)
:
desc
=
feature
[
1
]
...
...
@@ -14,5 +18,5 @@
desc
=
feature
[
1
]
print
name
+
'
:
'
,
desc
print
(
name
+
'
:
'
,
desc
)
def
test_features
():
failed
=
0
...
...
@@ -16,7 +20,7 @@
def
test_features
():
failed
=
0
for
name
,
feature
in
checks
.
iter
items
():
for
name
,
feature
in
checks
.
items
():
check
,
_
=
feature
try
:
check
()
...
...
@@ -20,8 +24,8 @@
check
,
_
=
feature
try
:
check
()
except
Exception
,
e
:
print
"
feature %s failed: %s
"
%
(
name
,
e
)
except
Exception
as
e
:
print
(
"
feature %s failed: %s
"
%
(
name
,
e
)
)
failed
+=
1
return
failed
...
...
@@ -30,8 +34,27 @@
help
=
"
test available features
"
)
parser
.
add_option
(
"
--list-features
"
,
action
=
"
store_true
"
,
help
=
"
list available features
"
)
parser
.
add_option
(
"
-q
"
,
"
--quiet
"
,
action
=
"
store_true
"
,
help
=
"
check features silently
"
)
def
_loadaddon
():
if
'
TESTDIR
'
in
os
.
environ
:
# loading from '.' isn't needed, because `hghave` should be
# running at TESTTMP in this case
path
=
os
.
environ
[
'
TESTDIR
'
]
else
:
path
=
'
.
'
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
'
hghaveaddon.py
'
)):
return
sys
.
path
.
insert
(
0
,
path
)
try
:
import
hghaveaddon
assert
hghaveaddon
# silence pyflakes
except
BaseException
as
inst
:
sys
.
stderr
.
write
(
'
failed to import hghaveaddon.py from %r: %s
\n
'
%
(
path
,
inst
))
sys
.
exit
(
2
)
sys
.
path
.
pop
(
0
)
if
__name__
==
'
__main__
'
:
options
,
args
=
parser
.
parse_args
()
...
...
@@ -35,6 +58,7 @@
if
__name__
==
'
__main__
'
:
options
,
args
=
parser
.
parse_args
()
_loadaddon
()
if
options
.
list_features
:
list_features
()
sys
.
exit
(
0
)
...
...
@@ -42,36 +66,4 @@
if
options
.
test_features
:
sys
.
exit
(
test_features
())
quiet
=
options
.
quiet
failures
=
0
def
error
(
msg
):
global
failures
if
not
quiet
:
sys
.
stderr
.
write
(
msg
+
'
\n
'
)
failures
+=
1
for
feature
in
args
:
negate
=
feature
.
startswith
(
'
no-
'
)
if
negate
:
feature
=
feature
[
3
:]
if
feature
not
in
checks
:
error
(
'
skipped: unknown feature:
'
+
feature
)
continue
check
,
desc
=
checks
[
feature
]
try
:
available
=
check
()
except
Exception
,
e
:
error
(
'
hghave check failed:
'
+
feature
)
continue
if
not
negate
and
not
available
:
error
(
'
skipped: missing feature:
'
+
desc
)
elif
negate
and
available
:
error
(
'
skipped: system supports %s
'
%
desc
)
if
failures
!=
0
:
sys
.
exit
(
1
)
hghave
.
require
(
args
)
This diff is collapsed.
Click to expand it.
tests/hghave.py
+
506
−
104
View file @
cca56bbe
This diff is collapsed.
Click to expand it.
tests/run-tests.py
+
341
−
236
View file @
cca56bbe
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment