Giter Club home page Giter Club logo

fastapi_eks_kubernetes's Introduction

Hi, I'm Mukul ๐Ÿ‘‹

background-cover

I am an individual who thrives on learning and holds a profound passion for technology. I see myself as an aficionado of software engineering and am also highly interested in content creation. Presently, I am employing the speedforce to absorb novel insights and competencies.

You can locate me across the internet ๐ŸŒŽ

LinkedIn Twitter YouTube

techstack

fastapi_eks_kubernetes's People

Contributors

mukulmantosh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fastapi_eks_kubernetes's Issues

tests do not pass with new SQLAlchemy version : set expire_on_commit=False to make it work

Hi,

First of all, thank you very much for your tutorial which is very good.
Just in case you would like to know, with new version of SQLAlchemy (I used 1.4.45), your tests cases for order and cart do not pass anylonger whereas it works like a charm with older version version (1.3.24 the one used in your tutorial) .

With new version of SQLAlchemy , the following errors raise:

========================================================================================= short test summary info =========================================================================================
FAILED test/cart/test_cart.py::test_add_to_cart - sqlalchemy.orm.exc.DetachedInstanceError: Instance <Product at 0x14dc9554e80> is not bound to a Session; attribute refresh operation cannot proceed (Ba...
FAILED test/orders/test_orders.py::test_order_processing - sqlalchemy.orm.exc.DetachedInstanceError: Instance <Product at 0x14dcb865df0> is not bound to a Session; attribute refresh operation cannot pr...
.....
 sqlalchemy.orm.exc.DetachedInstanceError: Instance <Product at 0x14dcb865df0> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: https://sqlalche.me/e/14/bhk3)"

The problem appears when trying to access to newly created product object attributes. For example, in file test_orders.py , function test_order_processing, line 19, in the statement params={'product_id': product_obj.id},:

async def test_order_processing(mocker):
   # mocker.patch('ecommerce.orders.tasks.send_email', return_value=True)

    async with AsyncClient(app=app, base_url="http://test") as ac:
        user_access_token = create_access_token({"sub": "[email protected]"})
        category_obj = await category_info()
        product_obj = await product_info(category_obj)

        cart_response = await ac.get(f"/cart/add",
                                     params={'product_id': product_obj.id},
                                     headers={'Authorization': f'Bearer {user_access_token}'})

Reading the SQLAlchemy, to make the tests cases work, Session.expire_on_commit shall be set to False.
I did it in file conf_test_db.py:
TestingSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine, expire_on_commit=False)

Et voilร  :) it works again :)

cheers!

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.