'tahoe debug trial' command #1296
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#1296
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
If there were a
tahoe debug trial
command, which runs Twisted Trial with a default testsuite ofallmydata.test
, that would have the following advantages:it would be guaranteed that the test suite run in this way would import the same code as the
bin/tahoe
command. Currently,setup.py trial
andbin/tahoe
set upsys.path
in different ways, which can result in not testing the same code that would be executed [*]it would be possible to run tests on executables created by bb-freeze, py2exe, etc. (#585)
the hack in source:setup.py#L54 to set
*requires*
could be removed. Perhaps setuptools_trial would not be needed at all.[*] The specific case in #1258 results in
bin/tahoe
running the "wrong" code whilesetup.py trial
runs the "right" code, but that appears to be just a coincidence of the ordering of*requires*
lists.Attachment tahoe-debug-trial.darcs.patch (13310 bytes) added
src/allmydata/scripts/debug.py: add 'tahoe debug trial' command. refs #1296
Attachment test-tahoe-debug-trial.darcs.patch (25660 bytes) added
Tests for 'tahoe debug trial'. refs #1296 (includes some dependency patches)
Attachment setup-use-tahoe-debug-trial.darcs.patch (27391 bytes) added
Change 'setup.py test' and 'setup.py trial' to use 'bin/tahoe debug trial'. Remove setuptools_trial which is no longer used. Remove a no-longer necessary hack from setup.py. refs #1296
Please look only at combined-debug-trial.darcs.patch and disregard the others.
Attachment combined-debug-trial.darcs.patch (37151 bytes) added
Combined changes to support 'tahoe debug trial'. This version is better-factored into patches and less dependent on Twisted Trial implementation details. It should also be correctly recorded relative to trunk.
In [4922/ticket1306]:
In [4923/ticket1306]:
In [4932/ticket1306]:
In [4933/ticket1306]:
Needs rebasing for trunk.
A preliminary review pass looks good. I definitely prefer the
sys.argv=['trial'..]
andtwisted_trial.run()
approach: itfeels like that should be reliable. I think I'd rather get the extra
arguments from
parseArgs()
instead ofsys.argv[3:]
though,as the latter feels fragile. Something like:
(and the
sys.exit(0)
is for paranoia, to avoid surprises if we're wrong. it's on the same line as twisted_trial.run() keep the code-coverage numbers good. It might be appropriate to raise an exception or do an assert or something there instead.)I think trial runs just fine without the
'allmydata'
or'allmydata.test'
hint: when run without arguments, it scansrecursively below the current directory for test files. If an argument
is necessary, I'd lean towards using
'allmydata'
rather than themore-specific
'allmydata.test'
, as we may want to put testselsewhere at some point (my #466 signed-introducer work creates
allmydata.util.ecdsa.test
, for example).I'd make the help synopsis say "run Tahoe test suite (using Trial)",
since users probably care slightly more about what the command does than
which particular test framework is involved, and unless you already known Trial,
you won't be able to figure out what the command does without a hint.
I'm a little wary of introducing
bin/tahoe.pyscript
in places wedon't need it, especially in the Makefile. I'd be happier if there were
some clean way to make
TAHOE=bin/tahoe
on non-windows. But I knowI'm in the minority when it comes to the Makefile, so I'm only a -0 on
that.
I'll have to do some comparison testing to see whether I'm happy with
changing
make quicktest
to use the new scheme. It feels likemapping that to 'tahoe debug trial' ought to be slightly faster (one
fewer subprocess?).
The other Makefile changes (turning
$(PYTHON) bin/tahoe stop
into$(TAHOE) stop
are probably good ones, but maybe they ought to gointo a separate patch, since they don't touch
tahoe debug trial
directly. (not a separate ticket, just a separate patch, so future code archaeologists have an easier time following the history)
Thanks for the review.
Replying to warner:
That wouldn't include option arguments (and there is no documented way to get the list of option arguments from an Options object). Would
sys.argv['debug', 'trial']len(['tahoe',):]
be more self-documenting?source:src/allmydata/runner.py
run()
would exit anyway iftrial(config)
were to return.That would incorrectly catch the source:src/buildtest module, which is intended only to be run from source:misc/build_helpers/test-with-fake-dists.py.
Hmm, the existing tests of
allmydata.util
are inallmydata.test.test_util
. We can always change this when/if we decide to put tests outsideallmydata.test
.It's not specific to running the Tahoe test suite, that's just the default. Remember that end-users are told to use
python setup.py test
(or can usepython setup.py trial
to avoid a build), which then invokesbin/tahoe debug trial
. Invoking it directly is a debugging operation, so the description needs to be oriented to debugging (for which it does matter that you're using Twisted Trial, and that the reason for using this rather than thetrial
script is that the imports are different).I'll change it to "Run tests using Twisted Trial with correct imports."
OK, I'll change this. (Note that
bin/tahoe
andbin/tahoe.pyscript
are identical files on all platforms now; see the last change in [4924/ticket1306].)There isn't one fewer subprocess, since
bin/tahoe
creates a subprocess (but that's an implementation detail that might change; for examplebin/tahoe
could useos.execve
on Unix, or it could mungesys.path
directly rather than using PYTHONPATH).The main point of this ticket is that we should only have one way to set up the imports, that is used both for running
bin/tahoe
normally and for running tests. The other code that was duplicating this set-up (source:misc/build_helpers/run-with-pythonpath.py and source:setup.pyRunWithPythonPath
), can now be deleted.They were in a separate changeset ([4927/ticket1306]), and will be on trunk.
Replying to [davidsarah]comment:10:
Sorry, I misread your comment. Yes, I'll separate out those changes.
Replying to warner:
Your feeling was right;
sys.argv[3:]
is fragile. In particular it breaks when there are options to tahoe, for example:will pass "
trial allmydata.test.test_base62
", to Trial, causing it to attempt to run a non-existent testsuite called "trial", in addition to test_base62. I'll find a more robust solution.Take a look at the internals of
usage.Options
: I think there's a method to override that will do what you want. In particular, if the 'tahoe debug trial' command doesn't take any options of it's own, I thinkparseArgs
would just give you everything.The following appears to work great, at least for things like "
tahoe debug trial
", "tahoe debug trial allmydata.test.test_foo
", and "tahoe debug trial --random-option random-argument
". It depends upon the fact thatTrialOptions
doesn't actually take any options or arguments: everything gets passed through totrial.run()
:Removing setuptools_trial would have a side-effect described in [this comment]source:setup.py@4940#L143:
(google cache of the related bug http://divmod.org/trac/ticket/2527 while divmod.org is down)
source:src/allmydata/test/test_nevow.py says that Nevow v0.9.33 fixed that bug. For references, all of the working buildbots have Nevow v0.10.0 except for 'Arthur lenny', which has v0.9.31.
I propose to bump the Nevow version requirement from >= 0.6.0 to >= 0.9.33. Any objection? (In the case of Ubuntu for example, 0.10.0 was packaged for Ubuntu Lucid in April 2010.)
Replying to davidsarah:
Does this mean we'd be requiring a version of Nevow newer than what Lenny packages?
http://packages.debian.org/search?keywords=nevow&searchon=names&suite=all§ion=all
Hm, yeah, Lenny has
0.9.31-3
. Oh, you know what -- removing the setup-time dependency onsetuptools_trial
doesn't actually eliminate the setup-time dependency onTwisted
, does it? We should probably replace thesetup_requires.extend(['setuptools_trial >= 0.5'])
withsetup_requires.append('Twisted >= 2.4.0')
. Maybe that will mean we don't need the newer version ofNevow
.I hope the Arthur lenny buildbot will tell us.
Replying to [zooko]comment:16:
Yes.
That sounds as though it might work, but I'll try just removing the setuptools_trial dependency first, and see if Arthur lenny breaks.
I'm curious to see what happens with the Arthur lenny buildslave. But, even if it works then it is working by accident, if we don't explicitly specify that
Twisted
is a setup-time requirement of Tahoe-LAFS (fortrial
).Attachment code-docs-test-1296.darcs.patch (25100 bytes) added
Code, documentation and test changes, rebased for trunk. Does not include removal of setuptools_trial or changes to 'setup.py trial'
my review:
docs/frontends/CLI.rst
andsrc/allmydata/test/trialtest.py
SystemTest.test_debug_trial
fails on my system (with twisted-10.2). I suspect that trial's output has changed in 10.2, you may need to be less strict in matching the output:Apart from that, it looks awesome. If you can confirm a trial-10.2 fix (you might want to check older versions of Twisted too, back to whatever minimum we support), go ahead and land it.
In changeset:7a887871b06af4a6:
In changeset:420aadd95efc176e:
In changeset:bbc1f56981e7aebf:
In changeset:0d6df9c9fc97f756:
In changeset:1819c25c888ac3e6:
Replying to zooko:
Given that Arthur lenny has Twisted 8.1.0 installed, it would have worked by accident.
In changeset:8f0af33ba6cf4f4a:
In changeset:7e413d4fa45932a8:
In changeset:5a7c99d29d85f32d:
I've reviewed changeset:5a7c99d29d85f32d/trunk and it looks good to me.
In changeset:74b1eec1d661a508:
Re: changeset:7e413d4fa45932a8/trunk, [this comment]source:trunk/setup.py@4950#L138 doesn't mention the other reason that we setup-require
Twisted
which is that we want to ensure thattrial
is available at test time. Oh, maybe that is best expressed [tests_require]source:trunk/setup.py@4950#L164 instead. (Buttests_require
will probably not be auto-satisfied when you runpython setup.py trial
the way they would be if you ranpython setup.py test
.) In any case we should probably specify a build-time or test-time requirement onTwisted
.Other than that, +1 on changeset:7e413d4fa45932a8/trunk!
+1 changeset:8f0af33ba6cf4f4a/trunk.
Replying to zooko:
Actually
trial
will be available when we run tests becauseTwisted
is a run-time dependency, andbin/tahoe debug trial
is a run-time thing from setuptools' point of view (because it's in a separate process that is started by a support script).From setuptools' point of view, we now don't do anything at test time, other than invoke the Trial command in source:setup.py.
In changeset:a9fc4668c0e0032c:
In changeset:9ea323db4ccbc778:
In changeset:d4969259c68bbe77:
So what's left on this ticket?
docs-needed
? Shall we close the ticket?news-needed
, and that's it. Docs were in changeset:bbc1f56981e7aebf (andbin/tahoe debug trial --help
prints all the options).I'll do a scan of version-control history to generate NEWS for 1.8.2, rather than rely upon
news-needed
tags. Closing this one out.The Ubuntu packagers of Tahoe-LAFS didn't notice this change from test-time dep to run-time dep and so Tahoe-LAFS in Natty doesn't declare a dep on python-mock and therefore won't run unless you manually install mock:
https://bugs.launchpad.net/tahoe-lafs/+bug/782379
Replying to zooko:
The NEWS for 1.8.2 did note this change. Is there any way we should be making such changes more obvious to packagers?
What would be awesome is if packagers had an automated test bot which would alert them automatically if they made a mistake like this. The NixOS project is the only packaging project I know of that has this:
http://hydra.nixos.org/job/nixpkgs/trunk/tahoelafs
But aside from encouraging packagers to get automated continuous integration, I don't think there's much more we can do, so let's leave this ticket closed.