Giter Club home page Giter Club logo

Comments (7)

untitaker avatar untitaker commented on July 26, 2024 1

Also whatever we come up with should ideally be reusable outside of todoman, particularly khal.

from todoman.

untitaker avatar untitaker commented on July 26, 2024 1

It appears that #170 introduces some sort of UI test. I suspect an easier approach would be to create a fake urwid.MainLoop.

from todoman.

WhyNotHugo avatar WhyNotHugo commented on July 26, 2024

My best idea so far is to implement a dummy Screen, and test against that (with some help from mock, probably).

See here for more relevant documentation.

from todoman.

untitaker avatar untitaker commented on July 26, 2024

I had hoped that there already is a testing framework/library for urwid. This is why I tagged this as lv: hard, because eventually we'd need to come up with our own.

from todoman.

WhyNotHugo avatar WhyNotHugo commented on July 26, 2024

So here's what I'm thinking right now:

  • Implement a screen-like class that doesn't do any outputting. I might just subclass that implementation and point output to /dev/null. If this turns out too complex, just write a class from scratch.
  • Instances of this class receive a list of keys, that it will simulate were pressed in that order (by returning them via get_input).
  • Write a test with a set of key-pressed, and check that the result (in the database) is the expected one, and that no exception were thrown.

This is a very high-level functional test, and not actual unit testing. Unit testing individual components can probably be done some other way.

We don't actually validate that thing look how we want them to, only that they behave how we want them to. The html_fragment display module can do that.

from todoman.

untitaker avatar untitaker commented on July 26, 2024

from todoman.

WhyNotHugo avatar WhyNotHugo commented on July 26, 2024

Maybe we can use/borrow this html comparison assertion code.

Otherwise yes, we could write our own display module based on the HTML one (I'm guessing lots of its logic would be reusable).

from todoman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.