Opened 2 years ago

Closed 2 weeks ago

#6535 enhancement closed fixed (fixed)

Document that tests should create test data, rather than storing as files in the python path.

Reported by: tom.prince Owned by: adiroiban
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch: branches/docs-test-data-6535
(github, patch, buildbot, log)
Author: Launchpad Bug:


<exarkun> keeping data in the source tree should be avoided where possible
<exarkun> I don't think anyone knows how to avoid it in _all_ cases, but where it's obvious how to do so it seems worthwhile.
<exarkun> And dumping data into a temporary path during the test run opens up more testing opportunities
<exarkun> If the data is part of the shipped source, then it's hard to rely on some of the less obvious properties (permissions, for example)
<exarkun> There's a handful of tests that fail when run against an installed copy of Twisted.  I dunno if this test is one of them, but it suffers from the same problem as the failing tests do, even if it doesn't have the same symptom

Change History (6)

comment:1 Changed 2 years ago by Julian

As per some discussion on #5787 (and some more on IRC with exarkun for which this is a rough summary), we should consider test cases for trial to be an exception on a case-by-case basis when a separate module (to discover) might be necessary. (Though of course defining the auxiliary test code on the test case that needs it is preferable when possible anyhow).

[the rationale being that it is beneficial to be able to invoke bin/trial on the test modules besides their use in the relevant test]

comment:2 Changed 8 months ago by adiroiban

  • Owner set to adiroiban

I will try to solve this ticket.

comment:3 Changed 4 weeks ago by adiroiban

  • Branch set to branches/docs-test-data-6535
  • Keywords review added; documentation policy removed
  • Owner adiroiban deleted

I have pushed an initial change to the documentation to talk about test data.

Please check and suggest changes.


comment:4 Changed 2 weeks ago by hawkowl

  • Keywords review removed
  • Owner set to adiroiban

Hi Adi, thanks for this.

Few minor nitpicks:

  • Line 238 needs to be brought onto the previous line (to match 1 sentence per line). Lines 242 and 243 also need to be modified to do this.
  • There's two instances where "getThing" is typo'd as "getThink" in the code example (lines 269 and 274)
  • I think lines 280 and so need to be reformed into a single paragraph or maybe two -- right now each sentence is its own paragraph.
  • "Test" -> "Tests" at line 291
  • I don't like the example docstring at line 303. It should mention keys.Key or so, rather than "it".

Please fix these up and merge.

comment:5 Changed 2 weeks ago by adiroiban

Thanks for the review. Will fix and merge. Thanks again!

comment:6 Changed 2 weeks ago by adiroiban

  • Resolution set to fixed
  • Status changed from new to closed

(In [46155]) Merge docs-test-data-6535: Update dev documentation to talk about test data and have example with task.Clock.

Author: adiroiban Reviewer: hawkowl Fixes: #6535

Note: See TracTickets for help on using tickets.