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

sqltests #25

Merged
merged 11 commits into from
May 27, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
language: python
python: '3.4'
python:
- '2.7'
- '3.4'
branches:
except: "/^v\\d/"
install: true
script: true
services:
- mysql
- postgresql
install:
- python setup.py install
- pip install mysqlclient
- pip install psycopg2
before_script:
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
- psql -c 'create database test;' -U postgres
script: python test/sqltests.py
deploy:
- provider: script
script: 'curl --fail --data "{ \"tag_name\": \"v$(python setup.py --version)\",
6 changes: 3 additions & 3 deletions tests/sqltests.py
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ def test_update_returns_affected_rows(self):
class MySQLTests(SQLTests):
@classmethod
def setUpClass(self):
self.db = SQL("mysql://root@localhost/cs50_sql_tests")
self.db = SQL("mysql://root@localhost/test")

def setUp(self):
self.db.execute("CREATE TABLE cs50 (id INTEGER NOT NULL AUTO_INCREMENT, val VARCHAR(16), PRIMARY KEY (id))")
@@ -95,7 +95,7 @@ def tearDownClass(self):
class PostgresTests(SQLTests):
@classmethod
def setUpClass(self):
self.db = SQL("postgresql://postgres@localhost/cs50_sql_tests")
self.db = SQL("postgresql://postgres@localhost/test")

def setUp(self):
self.db.execute("CREATE TABLE cs50 (id SERIAL PRIMARY KEY, val VARCHAR(16))")
@@ -114,7 +114,7 @@ def test_insert_returns_last_row_id(self):
class SQLiteTests(SQLTests):
@classmethod
def setUpClass(self):
self.db = SQL("sqlite:///cs50_sql_tests.db")
self.db = SQL("sqlite:///test.db")

def setUp(self):
self.db.execute("CREATE TABLE cs50(id INTEGER PRIMARY KEY, val TEXT)")