mjhea0 / flaskr-tdd

Flaskr: Intro to Flask, Test-Driven Development (TDD), and JavaScript

Home Page:http://flaskr-tdd.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Database Setup Test

clifford-b opened this issue · comments

There appears to be an issue with the test_database function. The guide claims that the test should pass, however the function is looking for the file in the tests directory but it does not exist there as it is in the parent directory.

def test_database():
assert Path("flaskr.db").is_file()

My current directory structure looks as follows

├── flaskr.db
├── project
│ ├── init.py
│ ├── app.py
│ └── schema.sql
└── tests
├── init.py
└── app_test.py

I modified the test to assert Path("../flaskr.db").is_file() to get the test to pass.

def test_database(client): """initial test. ensure that the database exists""" tester = Path("Flaskr.db").is_file() assert tester

I changed the test to the above code and it worked for me while working on Pycharm Professional