GithubHelp home page GithubHelp logo

packtpublishing / hands-on-docker-for-microservices-with-python Goto Github PK

View Code? Open in Web Editor NEW
205.0 21.0 223.0 192 KB

Hands-On Docker for Microservices with Python, published by Packt

License: MIT License

Python 77.06% HTML 5.47% Dockerfile 8.99% Shell 8.47%

hands-on-docker-for-microservices-with-python's Introduction

Hands-On Docker for Microservices with Python

Hands-On Docker for Microservices with Python

This is the code repository for Hands-On Docker for Microservices with Python , published by Packt.

Design, deploy, and operate a complex system with multiple microservices using Docker and Kubernetes

What is this book about?

Microservices architecture helps create complex systems with multiple, interconnected services that can be maintained by independent teams working in parallel. This book guides you on how to develop these complex systems with the help of containers.

This book covers the following exciting features:

  • Discover how to design, test, and operate scalable microservices
  • Coordinate and deploy different services using Kubernetes
  • Use Docker to construct scalable and manageable applications with microservices
  • Understand how to monitor a complete system to ensure early detection of problems
  • Become well versed with migrating from an existing monolithic system to a microservice one Use load balancing to ensure seamless operation between the old monolith and the new service

If you feel this book is for you, get your copy today!

Instructions and Navigations

All of the code is organized into folders. For example, Chapter02.

The code will look like the following:

class ThoughtModel(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(50))
    text = db.Column(db.String(250))
    timestamp = db.Column(db.DateTime, server_default=func.now())

Following is what you need for this book: This book is aimed at developers or software architects who work with complex systems and want to be able to scale the development of their systems.

It is also aimed at developers who typically deal with a monolith that has grown to a point where adding new features is difficult and development is difficult to scale. The book outlines the migration of a traditional monolithic system to a microservice architecture, providing a roadmap covering all the different stages.

With the following software and hardware list you can run all code files present in the book (Chapter 1-).

Software and Hardware List

Chapter Software required OS required
1-10 Python 3.8 Windows/Linux/macOS

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Errata

  • Page 7 (Paragraph 2, Line 1): Chapter 1, Making the Move – Design, Plan, Execute, describes a typical situation for a monolith system… should be Chapter 1, Making the Move – Design, Plan, and Execute, describes a typical situation for a monolith system…
  • Page 10 (Paragraph 4, Line 1): a frontend web server that exposes the port in HTTP/HTTPS, and a backend that runs the monolith code in a dedicated web worker. should be a frontend web server that exposes the port in HTTP/HTTPS and a backend one that runs the monolith code in a dedicated web worker.
  • Page 11 (Paragraph 2, Line 1): Each individual deployed web worker will... should be Each individually deployed web worker will...
  • Page 11 (Paragraph 6, Line 1): As the service is a whole, any... should be For the service is a whole, any...
  • Page 13 (Paragraph 6, Line 2): ...problem, but limiting its use so that it is contained, not requiring a drastic change in the company. should be ...problem. However, this technique's use should be restricted so that it is contained and does not require a drastic change in the company.
  • Page 40 (Paragraph 2, Line 2): API interface should be API
  • Page 41 (Paragraph 3, Line 2): We will discuss different elements such as the API design, the database schema that supports it, and how to implement and how to implement the microservice. should be We will discuss different elements such as the API design, the database schema that supports it, and how to implement the microservice.
  • Page 42 (Paragraph 1, Line 3): Installation and running instructions can be found on its README.md file. should be Installation and running instructions can be found in the README.md file.
  • Page 42 (Paragraph 3, Line 1): The diagram shows the different elements for our example system… should be The diagram shows the different elements in our example system…
  • Page 42 (Paragraph 4, Line 1): Thoughts Backend will be responsible for storing new thoughts… should be Thoughts Backend is responsible for storing new thoughts…
  • Page 43 (Paragraph 1, Line 4): logged user should be logged in user
  • Page 43 (Paragraph 2, Line 1): Note the fact that the user is logged also validates the fact that the user exists. should be The fact that the user is logged in also validates their existence.
  • Page 43 (Paragraph 4, Line 2): The JWT itself is encrypted, but the information contained here is mostly only relevant for checking the user that was logged. should be The JWT itself is encrypted, but the information contained here is mostly only relevant for checking the user who was logged in.
  • Page 43 (Last paragraph, Line 2): API interface should be API
  • Page 44 (Paragraph 3, Line 3): at the client should be at the client side
  • Page 45 (Paragraph 1, Line 1): API interface should be API
  • Page 45 (Line 7): Any user, even not authenticated, can perform these actions. should be Any user, even non-authenticated ones, can perform these actions.
  • Page 47 (Paragraph 1, Line 2): There are two approaches to dealing with databases… should be There are two approaches to deal with databases…
  • Page 47 (Last paragraph, Line 7): A well-tailored SQLAlchemy definition can perform some abstract tasks very efficiently, but it requires good knowledge of the tool. should be A well-tailored SQLAlchemy definition can perform some abstract tasks very efficiently, but you need to possess good knowledge of the tool.
  • Page 67 (Paragraph 1, Line 1): API interface should be API
  • Page 274 (Paragraph 4, Line 1): logged user should be logged in user

Related products

Get to Know the Author

Jaime Buelta has been a professional programmer since 2002 and a full-time Python developer since 2010. He has developed software for a variety of fields, focusing, in the last 10 years, on developing web services in Python in the gaming and finance industries. He has seen first hand the revolution of containerization for backend services over the years and has seen how they can improve the development process. He published his first book, Python Automation Cookbook, in 2018. He is a strong proponent of automating everything to make computers do most of the heavy lifting so that users can focus on the important stuff. He is currently living in Dublin, Ireland, and is a regular speaker at PyCon Ireland.

Suggestions and Feedback

Click here if you have any feedback or suggestions.

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781838823818

hands-on-docker-for-microservices-with-python's People

Contributors

jaimebuelta avatar manjusha29 avatar packt-itservice avatar packtutkarshr avatar romydias avatar shaileshj-packt 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  avatar  avatar  avatar  avatar  avatar

Watchers

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

hands-on-docker-for-microservices-with-python's Issues

changes in flask-restplus

Due to changes, one could fix possible errors by uninstalling flask-restplus and installing flask-restx instead. All import statements have to be adjusted accordingly.

Trying to get code working in 2023 for Chapter 02.

Hello,
I've been running into issues trying to get the code to work.

After doing a changing directory to where the requirements.txt is.
I ran these commands within the terminal:
$ python3.8 -m venv ./venv
$ source ./venv/bin/activate
$ pip install -r requirements.txt

and when I try to run the code as shown in the readme
$ python init_db.py

I get this result:

Traceback (most recent call last):
File "init_db.py", line 1, in
from thoughts_backend.app import create_app
File "/home/gene/Desktop/Hands-On-Docker-for-Microservices-with-Python/Chapter02/ThoughtsBackend/thoughts_backend/app.py", line 1, in
from flask import Flask
File "/home/gene/Desktop/Hands-On-Docker-for-Microservices-with-Python/Chapter02/ThoughtsBackend/venv/lib/python3.8/site-packages/flask/init.py", line 19, in
from jinja2 import Markup, escape
ImportError: cannot import name 'Markup' from 'jinja2' (/home/gene/Desktop/Hands-On-Docker-for-Microservices-with-Python/Chapter02/ThoughtsBackend/venv/lib/python3.8/site-packages/jinja2/init.py)

I'm thinking that this must be a outdated/broken dependency.

Chaper 3 code error: tests failed

Steps to reproduce:

From the page 86:
Run docker-compose run test-sqlite

Output:

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e00355f8>, first_connect_check = True

    def __connect(self, first_connect_check=False):
        pool = self.__pool
    
        # ensure any existing connection is removed, so that if
        # creator fails, this attribute stays None
        self.connection = None
        try:
            self.starttime = time.time()
>           connection = pool._invoke_creator(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

connection_record = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e00355f8>

    def connect(connection_record=None):
        if dialect._has_events:
            for fn in dialect.dispatch.do_connect:
                connection = fn(
                    dialect, connection_record, cargs, cparams
                )
                if connection is not None:
                    return connection
>       return dialect.connect(*cargs, **cparams)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89e00356a0>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlite3.OperationalError: unable to open database file

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError

The above exception was the direct cause of the following exception:

request = <SubRequest '_configure_application' for <Function test_list_me_thoughts>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f89e03e8f60>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::
    
            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'
    
        """
        if 'app' not in request.fixturenames:
            return
    
>       app = getfixturevalue(request, 'app')

../venv/lib/python3.6/site-packages/pytest_flask/plugin.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../venv/lib/python3.6/site-packages/pytest_flask/pytest_compat.py:3: in getfixturevalue
    return request.getfixturevalue(value)
tests/conftest.py:16: in app
    application.db.create_all()
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:963: in create_all
    self._execute_for_all_tables(app, bind, 'create_all')
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:955: in _execute_for_all_tables
    op(bind=self.get_engine(app, bind), **extra)
../venv/lib/python3.6/site-packages/sqlalchemy/sql/schema.py:4316: in create_all
    ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2048: in _run_visitor
    with self._optional_conn_ctx_manager(connection) as conn:
/usr/lib/python3.6/contextlib.py:81: in __enter__
    return next(self.gen)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2040: in _optional_conn_ctx_manager
    with self._contextual_connect() as conn:
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2242: in _contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2280: in _wrap_pool_connect
    e, dialect, self
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:1547: in _handle_dbapi_exception_noconnection
    util.raise_from_cause(sqlalchemy_exception, exc_info)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:398: in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:152: in reraise
    raise value.with_traceback(tb)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2276: in _wrap_pool_connect
    return fn()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:363: in connect
    return _ConnectionFairy._checkout(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:773: in _checkout
    fairy = _ConnectionRecord.checkout(pool)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:492: in checkout
    rec = pool._do_get()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py:238: in _do_get
    return self._create_connection()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:308: in _create_connection
    return _ConnectionRecord(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: in __init__
    self.__connect(first_connect_check=True)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: in __connect
    connection = pool._invoke_creator(self)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: in connect
    return dialect.connect(*cargs, **cparams)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89e00356a0>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
E       (Background on this error at: http://sqlalche.me/e/e3q8)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError
________________________________________________________________________________________________ ERROR at setup of test_list_me_unauthorized ________________________________________________________________________________________________

self = Engine(sqlite+pysqlite:////opt/code/thoughts_backend/../db.sqlite3), fn = <bound method Pool.connect of <sqlalchemy.pool.impl.NullPool object at 0x7f89e028a6a0>>, connection = None

    def _wrap_pool_connect(self, fn, connection):
        dialect = self.dialect
        try:
>           return fn()

../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e028a6a0>

    def connect(self):
        """Return a DBAPI connection from the pool.
    
        The connection is instrumented such that when its
        ``close()`` method is called, the connection will be returned to
        the pool.
    
        """
        if not self._use_threadlocal:
>           return _ConnectionFairy._checkout(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:363: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'sqlalchemy.pool.base._ConnectionFairy'>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e028a6a0>, threadconns = None, fairy = None

    @classmethod
    def _checkout(cls, pool, threadconns=None, fairy=None):
        if not fairy:
>           fairy = _ConnectionRecord.checkout(pool)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:773: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'sqlalchemy.pool.base._ConnectionRecord'>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e028a6a0>

    @classmethod
    def checkout(cls, pool):
>       rec = pool._do_get()

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:492: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e028a6a0>

    def _do_get(self):
>       return self._create_connection()

../venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py:238: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e028a6a0>

    def _create_connection(self):
        """Called by subclasses to create a new ConnectionRecord."""
    
>       return _ConnectionRecord(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:308: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e028a400>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e028a6a0>, connect = True

    def __init__(self, pool, connect=True):
        self.__pool = pool
        if connect:
>           self.__connect(first_connect_check=True)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e028a400>, first_connect_check = True

    def __connect(self, first_connect_check=False):
        pool = self.__pool
    
        # ensure any existing connection is removed, so that if
        # creator fails, this attribute stays None
        self.connection = None
        try:
            self.starttime = time.time()
>           connection = pool._invoke_creator(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

connection_record = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e028a400>

    def connect(connection_record=None):
        if dialect._has_events:
            for fn in dialect.dispatch.do_connect:
                connection = fn(
                    dialect, connection_record, cargs, cparams
                )
                if connection is not None:
                    return connection
>       return dialect.connect(*cargs, **cparams)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89e028a550>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlite3.OperationalError: unable to open database file

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError

The above exception was the direct cause of the following exception:

request = <SubRequest '_configure_application' for <Function test_list_me_unauthorized>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f89e024dc88>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::
    
            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'
    
        """
        if 'app' not in request.fixturenames:
            return
    
>       app = getfixturevalue(request, 'app')

../venv/lib/python3.6/site-packages/pytest_flask/plugin.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../venv/lib/python3.6/site-packages/pytest_flask/pytest_compat.py:3: in getfixturevalue
    return request.getfixturevalue(value)
tests/conftest.py:16: in app
    application.db.create_all()
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:963: in create_all
    self._execute_for_all_tables(app, bind, 'create_all')
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:955: in _execute_for_all_tables
    op(bind=self.get_engine(app, bind), **extra)
../venv/lib/python3.6/site-packages/sqlalchemy/sql/schema.py:4316: in create_all
    ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2048: in _run_visitor
    with self._optional_conn_ctx_manager(connection) as conn:
/usr/lib/python3.6/contextlib.py:81: in __enter__
    return next(self.gen)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2040: in _optional_conn_ctx_manager
    with self._contextual_connect() as conn:
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2242: in _contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2280: in _wrap_pool_connect
    e, dialect, self
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:1547: in _handle_dbapi_exception_noconnection
    util.raise_from_cause(sqlalchemy_exception, exc_info)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:398: in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:152: in reraise
    raise value.with_traceback(tb)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2276: in _wrap_pool_connect
    return fn()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:363: in connect
    return _ConnectionFairy._checkout(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:773: in _checkout
    fairy = _ConnectionRecord.checkout(pool)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:492: in checkout
    rec = pool._do_get()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py:238: in _do_get
    return self._create_connection()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:308: in _create_connection
    return _ConnectionRecord(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: in __init__
    self.__connect(first_connect_check=True)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: in __connect
    connection = pool._invoke_creator(self)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: in connect
    return dialect.connect(*cargs, **cparams)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89e028a550>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
E       (Background on this error at: http://sqlalche.me/e/e3q8)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError
___________________________________________________________________________________________________ ERROR at setup of test_list_thoughts ____________________________________________________________________________________________________

self = Engine(sqlite+pysqlite:////opt/code/thoughts_backend/../db.sqlite3), fn = <bound method Pool.connect of <sqlalchemy.pool.impl.NullPool object at 0x7f89e03dc208>>, connection = None

    def _wrap_pool_connect(self, fn, connection):
        dialect = self.dialect
        try:
>           return fn()

../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e03dc208>

    def connect(self):
        """Return a DBAPI connection from the pool.
    
        The connection is instrumented such that when its
        ``close()`` method is called, the connection will be returned to
        the pool.
    
        """
        if not self._use_threadlocal:
>           return _ConnectionFairy._checkout(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:363: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'sqlalchemy.pool.base._ConnectionFairy'>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e03dc208>, threadconns = None, fairy = None

    @classmethod
    def _checkout(cls, pool, threadconns=None, fairy=None):
        if not fairy:
>           fairy = _ConnectionRecord.checkout(pool)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:773: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'sqlalchemy.pool.base._ConnectionRecord'>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e03dc208>

    @classmethod
    def checkout(cls, pool):
>       rec = pool._do_get()

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:492: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e03dc208>

    def _do_get(self):
>       return self._create_connection()

../venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py:238: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e03dc208>

    def _create_connection(self):
        """Called by subclasses to create a new ConnectionRecord."""
    
>       return _ConnectionRecord(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:308: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e03dcb00>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e03dc208>, connect = True

    def __init__(self, pool, connect=True):
        self.__pool = pool
        if connect:
>           self.__connect(first_connect_check=True)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e03dcb00>, first_connect_check = True

    def __connect(self, first_connect_check=False):
        pool = self.__pool
    
        # ensure any existing connection is removed, so that if
        # creator fails, this attribute stays None
        self.connection = None
        try:
            self.starttime = time.time()
>           connection = pool._invoke_creator(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

connection_record = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e03dcb00>

    def connect(connection_record=None):
        if dialect._has_events:
            for fn in dialect.dispatch.do_connect:
                connection = fn(
                    dialect, connection_record, cargs, cparams
                )
                if connection is not None:
                    return connection
>       return dialect.connect(*cargs, **cparams)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89e03dc080>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlite3.OperationalError: unable to open database file

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError

The above exception was the direct cause of the following exception:

request = <SubRequest '_configure_application' for <Function test_list_thoughts>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f89e02a1978>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::
    
            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'
    
        """
        if 'app' not in request.fixturenames:
            return
    
>       app = getfixturevalue(request, 'app')

../venv/lib/python3.6/site-packages/pytest_flask/plugin.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../venv/lib/python3.6/site-packages/pytest_flask/pytest_compat.py:3: in getfixturevalue
    return request.getfixturevalue(value)
tests/conftest.py:16: in app
    application.db.create_all()
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:963: in create_all
    self._execute_for_all_tables(app, bind, 'create_all')
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:955: in _execute_for_all_tables
    op(bind=self.get_engine(app, bind), **extra)
../venv/lib/python3.6/site-packages/sqlalchemy/sql/schema.py:4316: in create_all
    ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2048: in _run_visitor
    with self._optional_conn_ctx_manager(connection) as conn:
/usr/lib/python3.6/contextlib.py:81: in __enter__
    return next(self.gen)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2040: in _optional_conn_ctx_manager
    with self._contextual_connect() as conn:
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2242: in _contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2280: in _wrap_pool_connect
    e, dialect, self
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:1547: in _handle_dbapi_exception_noconnection
    util.raise_from_cause(sqlalchemy_exception, exc_info)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:398: in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:152: in reraise
    raise value.with_traceback(tb)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2276: in _wrap_pool_connect
    return fn()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:363: in connect
    return _ConnectionFairy._checkout(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:773: in _checkout
    fairy = _ConnectionRecord.checkout(pool)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:492: in checkout
    rec = pool._do_get()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py:238: in _do_get
    return self._create_connection()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:308: in _create_connection
    return _ConnectionRecord(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: in __init__
    self.__connect(first_connect_check=True)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: in __connect
    connection = pool._invoke_creator(self)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: in connect
    return dialect.connect(*cargs, **cparams)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89e03dc080>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
E       (Background on this error at: http://sqlalche.me/e/e3q8)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError
________________________________________________________________________________________________ ERROR at setup of test_list_thoughts_search ________________________________________________________________________________________________

self = Engine(sqlite+pysqlite:////opt/code/thoughts_backend/../db.sqlite3), fn = <bound method Pool.connect of <sqlalchemy.pool.impl.NullPool object at 0x7f89e0205f98>>, connection = None

    def _wrap_pool_connect(self, fn, connection):
        dialect = self.dialect
        try:
>           return fn()

../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0205f98>

    def connect(self):
        """Return a DBAPI connection from the pool.
    
        The connection is instrumented such that when its
        ``close()`` method is called, the connection will be returned to
        the pool.
    
        """
        if not self._use_threadlocal:
>           return _ConnectionFairy._checkout(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:363: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'sqlalchemy.pool.base._ConnectionFairy'>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0205f98>, threadconns = None, fairy = None

    @classmethod
    def _checkout(cls, pool, threadconns=None, fairy=None):
        if not fairy:
>           fairy = _ConnectionRecord.checkout(pool)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:773: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'sqlalchemy.pool.base._ConnectionRecord'>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0205f98>

    @classmethod
    def checkout(cls, pool):
>       rec = pool._do_get()

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:492: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0205f98>

    def _do_get(self):
>       return self._create_connection()

../venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py:238: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0205f98>

    def _create_connection(self):
        """Called by subclasses to create a new ConnectionRecord."""
    
>       return _ConnectionRecord(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:308: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e0205d30>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0205f98>, connect = True

    def __init__(self, pool, connect=True):
        self.__pool = pool
        if connect:
>           self.__connect(first_connect_check=True)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e0205d30>, first_connect_check = True

    def __connect(self, first_connect_check=False):
        pool = self.__pool
    
        # ensure any existing connection is removed, so that if
        # creator fails, this attribute stays None
        self.connection = None
        try:
            self.starttime = time.time()
>           connection = pool._invoke_creator(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

connection_record = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e0205d30>

    def connect(connection_record=None):
        if dialect._has_events:
            for fn in dialect.dispatch.do_connect:
                connection = fn(
                    dialect, connection_record, cargs, cparams
                )
                if connection is not None:
                    return connection
>       return dialect.connect(*cargs, **cparams)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89e0205dd8>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlite3.OperationalError: unable to open database file

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError

The above exception was the direct cause of the following exception:

request = <SubRequest '_configure_application' for <Function test_list_thoughts_search>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f89e02614e0>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::
    
            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'
    
        """
        if 'app' not in request.fixturenames:
            return
    
>       app = getfixturevalue(request, 'app')

../venv/lib/python3.6/site-packages/pytest_flask/plugin.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../venv/lib/python3.6/site-packages/pytest_flask/pytest_compat.py:3: in getfixturevalue
    return request.getfixturevalue(value)
tests/conftest.py:16: in app
    application.db.create_all()
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:963: in create_all
    self._execute_for_all_tables(app, bind, 'create_all')
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:955: in _execute_for_all_tables
    op(bind=self.get_engine(app, bind), **extra)
../venv/lib/python3.6/site-packages/sqlalchemy/sql/schema.py:4316: in create_all
    ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2048: in _run_visitor
    with self._optional_conn_ctx_manager(connection) as conn:
/usr/lib/python3.6/contextlib.py:81: in __enter__
    return next(self.gen)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2040: in _optional_conn_ctx_manager
    with self._contextual_connect() as conn:
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2242: in _contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2280: in _wrap_pool_connect
    e, dialect, self
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:1547: in _handle_dbapi_exception_noconnection
    util.raise_from_cause(sqlalchemy_exception, exc_info)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:398: in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:152: in reraise
    raise value.with_traceback(tb)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2276: in _wrap_pool_connect
    return fn()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:363: in connect
    return _ConnectionFairy._checkout(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:773: in _checkout
    fairy = _ConnectionRecord.checkout(pool)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:492: in checkout
    rec = pool._do_get()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py:238: in _do_get
    return self._create_connection()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:308: in _create_connection
    return _ConnectionRecord(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: in __init__
    self.__connect(first_connect_check=True)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: in __connect
    connection = pool._invoke_creator(self)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: in connect
    return dialect.connect(*cargs, **cparams)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89e0205dd8>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
E       (Background on this error at: http://sqlalche.me/e/e3q8)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError
____________________________________________________________________________________________________ ERROR at setup of test_get_thought _____________________________________________________________________________________________________

self = Engine(sqlite+pysqlite:////opt/code/thoughts_backend/../db.sqlite3), fn = <bound method Pool.connect of <sqlalchemy.pool.impl.NullPool object at 0x7f89e0251f98>>, connection = None

    def _wrap_pool_connect(self, fn, connection):
        dialect = self.dialect
        try:
>           return fn()

../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0251f98>

    def connect(self):
        """Return a DBAPI connection from the pool.
    
        The connection is instrumented such that when its
        ``close()`` method is called, the connection will be returned to
        the pool.
    
        """
        if not self._use_threadlocal:
>           return _ConnectionFairy._checkout(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:363: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'sqlalchemy.pool.base._ConnectionFairy'>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0251f98>, threadconns = None, fairy = None

    @classmethod
    def _checkout(cls, pool, threadconns=None, fairy=None):
        if not fairy:
>           fairy = _ConnectionRecord.checkout(pool)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:773: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'sqlalchemy.pool.base._ConnectionRecord'>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0251f98>

    @classmethod
    def checkout(cls, pool):
>       rec = pool._do_get()

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:492: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0251f98>

    def _do_get(self):
>       return self._create_connection()

../venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py:238: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0251f98>

    def _create_connection(self):
        """Called by subclasses to create a new ConnectionRecord."""
    
>       return _ConnectionRecord(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:308: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e0251a90>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89e0251f98>, connect = True

    def __init__(self, pool, connect=True):
        self.__pool = pool
        if connect:
>           self.__connect(first_connect_check=True)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e0251a90>, first_connect_check = True

    def __connect(self, first_connect_check=False):
        pool = self.__pool
    
        # ensure any existing connection is removed, so that if
        # creator fails, this attribute stays None
        self.connection = None
        try:
            self.starttime = time.time()
>           connection = pool._invoke_creator(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

connection_record = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89e0251a90>

    def connect(connection_record=None):
        if dialect._has_events:
            for fn in dialect.dispatch.do_connect:
                connection = fn(
                    dialect, connection_record, cargs, cparams
                )
                if connection is not None:
                    return connection
>       return dialect.connect(*cargs, **cparams)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89e0251b38>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlite3.OperationalError: unable to open database file

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError

The above exception was the direct cause of the following exception:

request = <SubRequest '_configure_application' for <Function test_get_thought>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f89e03a5320>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::
    
            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'
    
        """
        if 'app' not in request.fixturenames:
            return
    
>       app = getfixturevalue(request, 'app')

../venv/lib/python3.6/site-packages/pytest_flask/plugin.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../venv/lib/python3.6/site-packages/pytest_flask/pytest_compat.py:3: in getfixturevalue
    return request.getfixturevalue(value)
tests/conftest.py:16: in app
    application.db.create_all()
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:963: in create_all
    self._execute_for_all_tables(app, bind, 'create_all')
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:955: in _execute_for_all_tables
    op(bind=self.get_engine(app, bind), **extra)
../venv/lib/python3.6/site-packages/sqlalchemy/sql/schema.py:4316: in create_all
    ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2048: in _run_visitor
    with self._optional_conn_ctx_manager(connection) as conn:
/usr/lib/python3.6/contextlib.py:81: in __enter__
    return next(self.gen)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2040: in _optional_conn_ctx_manager
    with self._contextual_connect() as conn:
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2242: in _contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2280: in _wrap_pool_connect
    e, dialect, self
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:1547: in _handle_dbapi_exception_noconnection
    util.raise_from_cause(sqlalchemy_exception, exc_info)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:398: in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:152: in reraise
    raise value.with_traceback(tb)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2276: in _wrap_pool_connect
    return fn()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:363: in connect
    return _ConnectionFairy._checkout(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:773: in _checkout
    fairy = _ConnectionRecord.checkout(pool)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:492: in checkout
    rec = pool._do_get()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py:238: in _do_get
    return self._create_connection()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:308: in _create_connection
    return _ConnectionRecord(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: in __init__
    self.__connect(first_connect_check=True)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: in __connect
    connection = pool._invoke_creator(self)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: in connect
    return dialect.connect(*cargs, **cparams)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89e0251b38>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
E       (Background on this error at: http://sqlalche.me/e/e3q8)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError
______________________________________________________________________________________________ ERROR at setup of test_get_non_existing_thought ______________________________________________________________________________________________

self = Engine(sqlite+pysqlite:////opt/code/thoughts_backend/../db.sqlite3), fn = <bound method Pool.connect of <sqlalchemy.pool.impl.NullPool object at 0x7f89dff00c18>>, connection = None

    def _wrap_pool_connect(self, fn, connection):
        dialect = self.dialect
        try:
>           return fn()

../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89dff00c18>

    def connect(self):
        """Return a DBAPI connection from the pool.
    
        The connection is instrumented such that when its
        ``close()`` method is called, the connection will be returned to
        the pool.
    
        """
        if not self._use_threadlocal:
>           return _ConnectionFairy._checkout(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:363: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'sqlalchemy.pool.base._ConnectionFairy'>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89dff00c18>, threadconns = None, fairy = None

    @classmethod
    def _checkout(cls, pool, threadconns=None, fairy=None):
        if not fairy:
>           fairy = _ConnectionRecord.checkout(pool)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:773: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'sqlalchemy.pool.base._ConnectionRecord'>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89dff00c18>

    @classmethod
    def checkout(cls, pool):
>       rec = pool._do_get()

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:492: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89dff00c18>

    def _do_get(self):
>       return self._create_connection()

../venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py:238: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.impl.NullPool object at 0x7f89dff00c18>

    def _create_connection(self):
        """Called by subclasses to create a new ConnectionRecord."""
    
>       return _ConnectionRecord(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:308: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89dff00710>, pool = <sqlalchemy.pool.impl.NullPool object at 0x7f89dff00c18>, connect = True

    def __init__(self, pool, connect=True):
        self.__pool = pool
        if connect:
>           self.__connect(first_connect_check=True)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89dff00710>, first_connect_check = True

    def __connect(self, first_connect_check=False):
        pool = self.__pool
    
        # ensure any existing connection is removed, so that if
        # creator fails, this attribute stays None
        self.connection = None
        try:
            self.starttime = time.time()
>           connection = pool._invoke_creator(self)

../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

connection_record = <sqlalchemy.pool.base._ConnectionRecord object at 0x7f89dff00710>

    def connect(connection_record=None):
        if dialect._has_events:
            for fn in dialect.dispatch.do_connect:
                connection = fn(
                    dialect, connection_record, cargs, cparams
                )
                if connection is not None:
                    return connection
>       return dialect.connect(*cargs, **cparams)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89dff007b8>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlite3.OperationalError: unable to open database file

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError

The above exception was the direct cause of the following exception:

request = <SubRequest '_configure_application' for <Function test_get_non_existing_thought>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f89e0334860>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::
    
            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'
    
        """
        if 'app' not in request.fixturenames:
            return
    
>       app = getfixturevalue(request, 'app')

../venv/lib/python3.6/site-packages/pytest_flask/plugin.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../venv/lib/python3.6/site-packages/pytest_flask/pytest_compat.py:3: in getfixturevalue
    return request.getfixturevalue(value)
tests/conftest.py:16: in app
    application.db.create_all()
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:963: in create_all
    self._execute_for_all_tables(app, bind, 'create_all')
../venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:955: in _execute_for_all_tables
    op(bind=self.get_engine(app, bind), **extra)
../venv/lib/python3.6/site-packages/sqlalchemy/sql/schema.py:4316: in create_all
    ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2048: in _run_visitor
    with self._optional_conn_ctx_manager(connection) as conn:
/usr/lib/python3.6/contextlib.py:81: in __enter__
    return next(self.gen)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2040: in _optional_conn_ctx_manager
    with self._contextual_connect() as conn:
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2242: in _contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2280: in _wrap_pool_connect
    e, dialect, self
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:1547: in _handle_dbapi_exception_noconnection
    util.raise_from_cause(sqlalchemy_exception, exc_info)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:398: in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:152: in reraise
    raise value.with_traceback(tb)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:2276: in _wrap_pool_connect
    return fn()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:363: in connect
    return _ConnectionFairy._checkout(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:773: in _checkout
    fairy = _ConnectionRecord.checkout(pool)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:492: in checkout
    rec = pool._do_get()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py:238: in _do_get
    return self._create_connection()
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:308: in _create_connection
    return _ConnectionRecord(self)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:437: in __init__
    self.__connect(first_connect_check=True)
../venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py:652: in __connect
    connection = pool._invoke_creator(self)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py:114: in connect
    return dialect.connect(*cargs, **cparams)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f89dff007b8>, cargs = ('/opt/code/db.sqlite3',), cparams = {}

    def connect(self, *cargs, **cparams):
>       return self.dbapi.connect(*cargs, **cparams)
E       sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
E       (Background on this error at: http://sqlalche.me/e/e3q8)

../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:489: OperationalError
================================================================================================= 9 passed, 24 warnings, 8 errors in 5.89s ==================================================================================================

Container building from chapter 3 throwing error.

Here is the full command and output:

`➜ Chapter03 git:(master) docker build -f docker/app/Dockerfile --tag thoughts-backend .
[+] Building 3.8s (7/23)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/alpine:3.9 2.8s
=> [internal] load build context 0.0s
=> => transferring context: 1.30kB 0.0s
=> CACHED [compile-image 1/10] FROM docker.io/library/alpine:3.9@sha256:414e0518bb9228d35e4cd5165567fb91d26c6a214e9c95899e1e056fcd349011 0.0s
=> ERROR [compile-image 2/10] RUN apk add --update python3 0.9s
=> ERROR [runtime-image 2/10] RUN apk add --update python3 curl libffi postgresql-libs 0.9s

[compile-image 2/10] RUN apk add --update python3:
#12 0.360 fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
#12 0.544 fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
#12 0.545 ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.9/main: BAD signature
#12 0.545 WARNING: Ignoring APKINDEX.b89edf6e.tar.gz: No such file or directory
#12 0.839 ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.9/community: BAD signature
#12 0.839 WARNING: Ignoring APKINDEX.737f7e01.tar.gz: No such file or directory
#12 0.840 ERROR: unsatisfiable constraints:
#12 0.841 python3 (missing):
#12 0.841 required by: world[python3]



[runtime-image 2/10] RUN apk add --update python3 curl libffi postgresql-libs:
#5 0.388 fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
#5 0.535 ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.9/main: BAD signature
#5 0.536 WARNING: Ignoring APKINDEX.b89edf6e.tar.gz: No such file or directory
#5 0.536 fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
#5 0.833 ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.9/community: BAD signature
#5 0.833 WARNING: Ignoring APKINDEX.737f7e01.tar.gz: No such file or directory
#5 0.833 ERROR: unsatisfiable constraints:
#5 0.836 curl (missing):
#5 0.836 required by: world[curl]
#5 0.836 libffi (missing):
#5 0.836 required by: world[libffi]
#5 0.836 postgresql-libs (missing):
#5 0.836 required by: world[postgresql-libs]
#5 0.836 python3 (missing):
#5 0.836 required by: world[python3]


executor failed running [/bin/sh -c apk add --update python3]: exit code: 1`

Unable to build "db" image in chapter 4.

Getting following Permission Denied error:

 => CACHED [ 4/15] RUN apk add bash curl su-exec python3                                                                                                                                               0.0s
 => CACHED [ 5/15] RUN apk add postgresql postgresql-contrib postgresql-dev                                                                                                                            0.0s
 => CACHED [ 6/15] RUN apk add python3-dev build-base linux-headers gcc libffi-dev                                                                                                                     0.0s
 => CACHED [ 7/15] WORKDIR /opt/code                                                                                                                                                                   0.0s
 => CACHED [ 8/15] RUN mkdir -p /opt/code/db                                                                                                                                                           0.0s
 => CACHED [ 9/15] ADD ./docker/db/postgres-setup.sh /opt/code/db/                                                                                                                                     0.0s
 => ERROR [10/15] RUN  /opt/code/db/postgres-setup.sh                                                                                                                                                  0.4s
------
 > [10/15] RUN  /opt/code/db/postgres-setup.sh:
#14 0.355 /bin/sh: /opt/code/db/postgres-setup.sh: Permission denied
------
executor failed running [/bin/sh -c /opt/code/db/postgres-setup.sh]: exit code: 126

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.