Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session.py side effects #226

Open
stveit opened this issue Nov 18, 2021 · 0 comments
Open

session.py side effects #226

stveit opened this issue Nov 18, 2021 · 0 comments

Comments

@stveit
Copy link
Contributor

stveit commented Nov 18, 2021

Is your feature request related to a problem? Please describe.
We have had issues regarding the session.py module. The module automatically runs code for connecting to the database.
So when we want to test just a function (a unit test if you will), and this module imports from session.py then the program will crash
if there is no db to connect to. This also of course happens if the module you test imports another module which imports session.py, so this can be quite frustrating.

Describe the solution you'd like
We want the session.py to not automatically attempt to connect to the database when imported. The simplest solution would be to just put the code in a function, and call the function when its needed. As far as i can see, the only code that references any of the varibles created is the sqla_session function. So creating a function, and calling the function from sqla_session.py is a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant