Skip to content

Commit

Permalink
oss: make 'make tests' run Python tests (#458)
Browse files Browse the repository at this point in the history
Summary:
oss: make 'make tests' run Python tests
'make check' tries to run 'make tests', but despite being documented, the
'tests' target does not exist in the Makefile.

Create a 'tests' target which runs the Python test suite.

Pull Request resolved: #458

Test Plan:
$ make oss
    $ make check
    [bunch of failures]
    $ (cd tests && python run-tests.py test-debugcheckcasecollisions.t)
    ----------------------------------------------------------------------
    # Ran 1 tests, 0 skipped, 0 failed.

 ---
Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/sapling/pull/458).
* #459
* __->__ #458

Reviewed By: muirdm

Differential Revision: D42742607

Pulled By: zzl0

fbshipit-source-id: 790624f28da629fe25846d1dde1fad2aa3382911
  • Loading branch information
strager authored and facebook-github-bot committed Jan 27, 2023
1 parent 3d66392 commit 731ba04
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
5 changes: 5 additions & 0 deletions eden/scm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ test-getdeps: install-getdeps

check: tests

.PHONY: tests
tests:
cd tests && PYTHON_SYS_EXECUTABLE=$(shell $(PYTHON3) contrib/pick_python.py $(PYTHON3)) \
$(shell $(PYTHON3) contrib/pick_python.py $(PYTHON3)) run-tests.py

update-pot: i18n/hg.pot

i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext
Expand Down
25 changes: 14 additions & 11 deletions eden/scm/tests/run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,19 +694,22 @@ def parseargs(args, parser):
os.path.isfile(options.with_hg) and os.access(options.with_hg, os.X_OK)
):
parser.error("--with-hg must specify an executable hg script")
if options.local:
if options.local and not options.with_hg:
testdir = os.path.dirname(canonpath(sys.argv[0]))
reporootdir = os.path.dirname(testdir)
pathandattrs = [("hg", "with_hg")]
for relpath, attr in pathandattrs:
if getattr(options, attr, None):
continue
binpath = os.path.join(reporootdir, relpath)
if os.name != "nt" and not os.access(binpath, os.X_OK):
parser.error(
"--local specified, but %r not found or not executable" % binpath
)
setattr(options, attr, binpath)
exe_names = ("sl", "hg")
if os.name == "nt":
exe_names = ("sl", "sl.exe", "hg", "hg.exe")
for exe_name in exe_names:
binpath = os.path.join(reporootdir, exe_name)
if os.access(binpath, os.X_OK):
options.with_hg = binpath
break
if not options.with_hg:
parser.error(
"--local specified, but %s not found in %r or not executable"
% (" or ".join(exe_names), reporootdir)
)

if options.chg and os.name == "nt":
parser.error("chg does not work on %s" % os.name)
Expand Down

0 comments on commit 731ba04

Please sign in to comment.