py4e icon indicating copy to clipboard operation
py4e copied to clipboard

db2.py fails travis tests due to missing db

Open ckolos opened this issue 8 years ago • 1 comments

If a change is made to db2.py in the code3/ folder, subsequent travis checks fail because the database + table don't exist/exist yet.

ckolos avatar Apr 30 '16 20:04 ckolos

Thanks for this report! I'm going to be fixing a bunch of bugs and republishing the trinket HTML version of this in the next two weeks and will hit this.

The fix here is to add

cur.execute('DROP TABLE IF EXISTS Tracks')
cur.execute('CREATE TABLE Tracks (title TEXT, plays INTEGER)')

Above the INSERTS. The code presumes that db1.py has already run but this fix makes it work regardless of that.

eah13 avatar Feb 28 '17 13:02 eah13