Giter Site home page Giter Site logo

Migrate the Tests to Nose about mosql HOT 5 CLOSED

moskytw avatar moskytw commented on June 6, 2024
Migrate the Tests to Nose

from mosql.

Comments (5)

eugene-eeo avatar eugene-eeo commented on June 6, 2024

Although this is more of a personal thing, and I'm not advocating for any specific testing tool, I suggest using pytest. One benefit of it is that it has really good assert rewriting which makes it possible to write tests such as:

variable = function()
assert variable == 1

And still get good feedback from the unit testing system rather than a plain AssertionError. Furthermore, py.test has a really good fixtures system that enables you to write really clean code, without having to do any test-case inheritance unless your needs are a little special. You can also use both functions and classes in your code:

class TestFunction:
    def test_one_is_given(self):
        assert f(1) == 2

def test_function():
    assert f(1) == 2

Lastly it seems that more projects are using pytest compared to nose, so chances are that more developers are more familiar with pytest which means more people would be comfortable with contributing to the code.

from mosql.

moskytw avatar moskytw commented on June 6, 2024

I remember nose can do all the things you mentioned. Cloud you provide more references about pytest is better than nose?

from mosql.

eugene-eeo avatar eugene-eeo commented on June 6, 2024

http://stackoverflow.com/questions/22856638/nose-vs-pytest-what-are-the-subjective-differences-that-should-make-me-pick

http://halfcooked.com/presentations/pyconau2013/why_I_use_pytest.html

from mosql.

uranusjr avatar uranusjr commented on June 6, 2024

I’ll admit that documentation on Nose is sparse (putting it mildly) compared to pytest. I can’t say too much about Unicode tracebacks, but since Python 2 is terrible at this in general I’d say using non-ASCII characters in tracebacks is not a good idea in most cases.

The thing is, there are already tests written with Nose, and somebody needs to convert them to pytest test cases if we’re to make the switch. This includes all tests inside the tests directory (no many), and a nose plugin that runs Sphinx doctests inside Nose. AFAIK no such plugin on pytest exists, so somebody will need to implement that as well. I like pytest, but it might not be the right tool right now as this project currently stands.

BTW is this issue really necessary now? IIRC all failed doctests have already been converted to nose tests, and other doctests work fine as-is.

from mosql.

moskytw avatar moskytw commented on June 6, 2024

@uranusjr yeah, I just forgot close this issue actually.

@eugene-eeo I don't see enough improvement if we switch to pytest. But still thanks for you introduced pytest to us. :)

I will close this issue.

from mosql.

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.