Coder Social home page Coder Social logo

Migrate to pytest about ihatemoney HOT 2 CLOSED

Glandos avatar Glandos commented on July 27, 2024
Migrate to pytest

from ihatemoney.

Comments (2)

Glandos avatar Glandos commented on July 27, 2024

unittest.MagicMock and patch

Not yet identified

flask_testing.TestCase

  • Could be replaced by a fixture to create the app, as before.
  • Creating the database seems to be left as an exercise for the user.

unittest assertions

Not yet identified

from ihatemoney.

hamma741 avatar hamma741 commented on July 27, 2024

It's great that you are considering moving away from Flask-Testing and exploring other options for writing tests in Flask. As you mentioned, using fixtures with pytest is a popular approach for testing Flask applications.

In addition to pytest, there are other testing frameworks that you may want to consider, such as nose or unittest2. However, pytest is widely used and offers many features that make it a popular choice among developers.

To get started with using pytest for testing Flask, you can take a look at the official Flask documentation on testing with pytest (https://flask.palletsprojects.com/en/2.1.x/testing/pytest/). This guide provides an overview of how to use pytest with Flask, including how to create test fixtures, how to write tests using the Flask test client, and how to run tests using pytest.

In general, moving to pytest involves refactoring your existing tests to use pytest fixtures and syntax. This may take some time, but it can provide significant benefits in terms of test organization, readability, and maintainability.

Some benefits of using pytest over Flask-Testing include:

Pytest offers a more powerful and flexible testing framework, with many built-in features for test discovery, test organization, and test execution.
Pytest has a large and active community, with many plugins and extensions available for customizing and extending its functionality.
Pytest is compatible with many other testing tools and frameworks, making it easy to integrate with your existing development workflow.
Overall, moving to pytest can be a great way to improve your testing process and ensure that your Flask applications are robust, reliable, and easy to maintain.

from ihatemoney.

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.