Skip to content

Port test suite from spec/nose to pytest(-relaxed) #515

@bitprophet

Description

@bitprophet

Background

I've moved some of my other projects over to pytest by way of my heavily-inspired-by-spec pytest plugin, but left Invoke for close to last as it's got by the largest test suite of my projects at this point (given I wrote it myself & it's been TDD the whole way.)

Taking a quick stab at it now to see just how big a hurdle it is; if I'm lucky it'll mostly work as-is & I can switch all the tooling over, then port the idioms (eg replacing nose/spec/custom tests with assert, replacing some test helpers with fixtures as appropriate, etc) at whatever pace I want.

Mostly I just want to avoid having to write any additional code in the old vein, eg I want my fancy asserts (esp since I've gotten used to similar goodies in modern unittest like assertMultilineEqual.)

Also hoping for maybe a bit more speed, but suspect the now 5 full seconds long test run (!) is probably more due to hundreds of file accesses (loading configs and tasks fixtures) and subprocess overhead, than to nose being "slow".

TODO

  • Initial base pass re: getting all tests passing, period, as-is or as close as possible
  • Uninstall spec, remove all spec imports, and replace use of its tooling (eg assert_contains etc)
  • Consider replacing the non-spec-related parts of IntegrationSpec (mostly setup/teardown) with pytest class-level fixtures...but punting's OK too (maybe make a spinoff ticket)
  • Integration tests
  • Coverage execution
  • Python 3 checkup.
  • Release some more tweaks to pytest-relaxed I had to make
  • Update our requirements to use that version
  • Triple check same test count
  • Update internal Invoke test tasks (should be able to use invocations as elsewhere)
  • Make sure any missing-but-acceptable functionality is documented over on relaxed's tracker (e.g. lack of docstring support)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions