separate configuration from instantiation of Client instance #1548

Open
opened 2011-09-26 21:08:45 +00:00 by zooko · 10 comments

I'm writing tests of configuration, and currently reading values from the configuration and using them is done inside the constructor of [Client]source:trunk/src/allmydata/client.py?annotate=blame&rev=5232#L111. I would rather there be some separate code that reads the values from configuration and does whatever validation and parsing is necessary and then passes all configuration options as arguments to the constructor of the class. This would be as prescribed in [the CodingStandards document](wiki/CodingStandards).

I'm writing tests of configuration, and currently reading values from the configuration and using them is done inside the constructor of [Client]source:trunk/src/allmydata/client.py?annotate=blame&rev=5232#L111. I would rather there be some separate code that reads the values from configuration and does whatever validation and parsing is necessary and then passes all configuration options as arguments to the constructor of the class. This would be as prescribed in [the [CodingStandards](wiki/CodingStandards) document](wiki/CodingStandards).
zooko added the
code-nodeadmin
major
enhancement
1.9.0a2
labels 2011-09-26 21:08:45 +00:00
zooko added this to the undecided milestone 2011-09-26 21:08:45 +00:00
zooko self-assigned this 2011-09-26 21:08:45 +00:00
Author

Here is a patch to rename Client to ClientAndServer and to put a little shim into place so that .tac files can continue invoking allmydata.client.Client.

Here is a patch to rename `Client` to `ClientAndServer` and to put a little shim into place so that .tac files can continue invoking `allmydata.client.Client`.
Author

Attachment renameClient.dpatch (6695 bytes) added

**Attachment** renameClient.dpatch (6695 bytes) added
davidsarah commented 2011-09-27 22:01:18 +00:00
Owner

renameClient.dpatch causes this test failure (looks like just a missing rename):

[ERROR]: allmydata.test.test_upload

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/twisted/trial/runner.py", line 584, in loadPackage
    module = modinfo.load()
  File "/usr/lib/python2.6/dist-packages/twisted/python/modules.py", line 383, in load
    return self.pathEntry.pythonPath.moduleLoader(self.name)
  File "/usr/lib/python2.6/dist-packages/twisted/python/reflect.py", line 464, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/usr/lib/python2.6/dist-packages/twisted/python/reflect.py", line 400, in _importAndCheckStack
    return __import__(importName)
  File "/home/davidsarah/tahoe/ticket999-S3-backend/src/allmydata/test/test_upload.py", line 186, in <module>
    class FakeClient:
  File "/home/davidsarah/tahoe/ticket999-S3-backend/src/allmydata/test/test_upload.py", line 209, in FakeClient
    _secret_holder = client.SecretHolder("lease secret", "convergence secret")
exceptions.AttributeError: 'module' object has no attribute 'SecretHolder'
-------------------------------------------------------------------------------
[renameClient.dpatch](/tahoe-lafs/trac-2024-07-25/attachments/000078ac-a575-bcef-dc7a-acf3ac022fc1) causes this test failure (looks like just a missing rename): ``` [ERROR]: allmydata.test.test_upload Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/twisted/trial/runner.py", line 584, in loadPackage module = modinfo.load() File "/usr/lib/python2.6/dist-packages/twisted/python/modules.py", line 383, in load return self.pathEntry.pythonPath.moduleLoader(self.name) File "/usr/lib/python2.6/dist-packages/twisted/python/reflect.py", line 464, in namedAny topLevelPackage = _importAndCheckStack(trialname) File "/usr/lib/python2.6/dist-packages/twisted/python/reflect.py", line 400, in _importAndCheckStack return __import__(importName) File "/home/davidsarah/tahoe/ticket999-S3-backend/src/allmydata/test/test_upload.py", line 186, in <module> class FakeClient: File "/home/davidsarah/tahoe/ticket999-S3-backend/src/allmydata/test/test_upload.py", line 209, in FakeClient _secret_holder = client.SecretHolder("lease secret", "convergence secret") exceptions.AttributeError: 'module' object has no attribute 'SecretHolder' ------------------------------------------------------------------------------- ```
davidsarah commented 2011-09-27 22:09:17 +00:00
Owner

Attachment 1548-fix-missing-rename.darcs.patch (7776 bytes) added

test/test_upload.py: fix a missing rename of client to clientandserver. refs #1548 (Includes previous patch.)

**Attachment** 1548-fix-missing-rename.darcs.patch (7776 bytes) added test/test_upload.py: fix a missing rename of client to clientandserver. refs #1548 (Includes previous patch.)
tahoe-lafs added
normal
and removed
major
labels 2012-03-29 19:28:00 +00:00
Author

Hm, what's the status of this patch? Is it ready for code review?

Hm, what's the status of this patch? Is it ready for code review?
daira commented 2013-10-17 15:19:13 +00:00
Owner

I'd forgotten all about this ticket. The patch will need redoing for git, but I approve in principle of making this change after 1.11.

I'd forgotten all about this ticket. The patch will need redoing for git, but I approve in principle of making this change after 1.11.
tahoe-lafs modified the milestone from undecided to 1.12.0 2013-10-17 15:19:13 +00:00

Milestone renamed

Milestone renamed
warner modified the milestone from 1.12.0 to 1.13.0 2016-03-22 05:02:25 +00:00

renaming milestone

renaming milestone
warner modified the milestone from 1.13.0 to 1.14.0 2016-06-28 18:17:14 +00:00

Moving open issues out of closed milestones.

Moving open issues out of closed milestones.
exarkun modified the milestone from 1.14.0 to 1.15.0 2020-06-30 14:45:13 +00:00
Owner

Ticket retargeted after milestone closed

Ticket retargeted after milestone closed
meejah modified the milestone from 1.15.0 to soon 2021-03-30 18:40:19 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#1548
No description provided.