Add dependency on a mocking library #1016

Closed
opened 2010-04-06 11:08:10 +00:00 by francois · 9 comments
francois commented 2010-04-06 11:08:10 +00:00
Owner

A mocking library comes handy for writing tests which exercise only a specific class or function independently of the rest of the code. This is especially useful with system functions like os.listdir() which works differently across platforms.

On #tahoe-lafs, Zooko proposed to use the mock Python library written by Michael Foord.

If nobody objects, I'll post a patch which add a dependency on mock in source:/_auto_deps.py#L1.

A mocking library comes handy for writing tests which exercise only a specific class or function independently of the rest of the code. This is especially useful with system functions like `os.listdir()` which works differently across platforms. On #tahoe-lafs, Zooko proposed to use the `mock` Python library written by Michael Foord. If nobody objects, I'll post a patch which add a dependency on `mock` in source:/_auto_deps.py#L1.
tahoe-lafs added the
code
minor
enhancement
1.6.1
labels 2010-04-06 11:08:10 +00:00
tahoe-lafs added this to the 1.7.0 milestone 2010-04-06 11:08:10 +00:00

Yeah, go ahead.

Yeah, go ahead.
francois commented 2010-04-06 13:27:24 +00:00
Author
Owner

Attachment add-mock-dependency.dpatch (2057 bytes) added

**Attachment** add-mock-dependency.dpatch (2057 bytes) added
francois commented 2010-04-06 13:28:42 +00:00
Author
Owner

Here is it.

Here is it.

Let's wait til we have tests that use this library and then commit the patch that adds the dependency along with the patch that uses it.

Let's wait til we have tests that use this library and then commit the patch that adds the dependency along with the patch that uses it.
francois commented 2010-05-22 14:14:46 +00:00
Author
Owner

The patch has been pushed as part of work on #534 (Unicode issues in CLI) in branch ticket534.

The patch has been pushed as part of work on #534 (Unicode issues in CLI) in branch [ticket534](http://tahoe-lafs.org/trac/tahoe-lafs-ticket534).
davidsarah commented 2010-06-03 04:31:24 +00:00
Author
Owner

zooko is merging the ticket534 branch.

zooko is merging the ticket534 branch.

This was done in changeset:b2542b87085be095. But I just now realized that it was done wrong! mock is a test-time dependency not a run-time dependency, so it should be included in tests_require in source:setup.py and excluded from install_requires in source:_auto_deps.py.

This was done in changeset:b2542b87085be095. But I just now realized that it was done wrong! `mock` is a test-time dependency not a run-time dependency, so it should be included in `tests_require` in source:setup.py and excluded from `install_requires` in source:_auto_deps.py.

Attachment mock-require.dpatch (46452 bytes) added

**Attachment** mock-require.dpatch (46452 bytes) added
francois commented 2010-06-09 07:55:28 +00:00
Author
Owner

I didn't knew about tests_require. That's indeed a good idea to use it.

Zooko, the patch looks correct and the functionality (mock dependency is installed if unit tests are run) is working as expected so I'll close this ticket.

I didn't knew about `tests_require`. That's indeed a good idea to use it. Zooko, the patch looks correct and the functionality (mock dependency is installed if unit tests are run) is working as expected so I'll close this ticket.
tahoe-lafs added the
fixed
label 2010-06-09 07:55:28 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 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#1016
No description provided.