flask-bookshelf | Flask Series | Time Series Database library
kandi X-RAY | flask-bookshelf Summary
kandi X-RAY | flask-bookshelf Summary
Flask Series
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Returns the path to instance folder
- Return application base path
- Create users
- Configure the Flask application
- Create the authors and book
- Create admin roles
flask-bookshelf Key Features
flask-bookshelf Examples and Code Snippets
Community Discussions
Trending Discussions on flask-bookshelf
QUESTION
I have a project where I defined a test configration in config.py
, but I'm puzzled by the following:
Many times there is a testing configuration for
config.py
being discussed in tutorials, like this oneActual testing with database is usually done on application and database defined in testclass (with or without Flask-Testing). This test setup does not make use of testing configuration from
config.py
See for example Flask-SQLAlchemy own test fixtures or some of links listed here
There is some advice about a test database being created specifically for the tests, eg from testing-with-sqlalchemy:
First, ensure you set the database URI to something other than your production database ! Second, it’s usually a good idea to create and drop your tables with each test run, to ensure clean tests
There are no tutorials that say "you do not need a testing configuration, do your test setup in your base test class". Is this something assumed?
Tst configuration
in config.py
and explicit test setup in class - are they mutually exclusive?
Or sometimes you combine the two?
P.S. Here is a list of project configurations without testing config.
...ANSWER
Answered 2017-Oct-18 at 14:09tl;dr: It is usually a matter of convenience. Prefer definitions in test module.
Are a test configuration in config.py and explicit test setup in class mutually exclusive? Or sometimes you combine the two?
They are NOT mutually exclusive. You can put the config values
- in the
config.py
(or) - in the test module (or)
- in both.
Here is an example using the config.py
route for motivation.
The decision to store the test config is mostly project dependent.
The config.py
with the class inheritance structure comes with its own set of rules. There are certain values like SECRET_KEY
and Database connection strings which has to be changed at the deployment stage in order to ensure application security. So, in order to handle such a situation (especially in public open source projects) there is usually a file like config.py.default
which carries all the default values. The developer/admin can copy this to config.py and add the values as per requirement. Using such a default config is recommended in Flask docs.
In situations involving automated testing (eg., Continuous Integration), such a default config setup becomes unusable. So storing the test config in the modules provides a convenient solution.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install flask-bookshelf
You can use flask-bookshelf like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page