Skip to content

Commit

Permalink
update travis fix coveralls, enable postgresql test
Browse files Browse the repository at this point in the history
  • Loading branch information
binux committed Oct 12, 2015
1 parent abd926d commit 23f2466
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 34 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@ services:
- mongodb
- rabbitmq
- redis-server
#addons:
#postgresql: "9.4"
addons:
postgresql: "9.4"
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y beanstalkd
- echo "START=yes" | sudo tee -a /etc/default/beanstalkd > /dev/null
- sudo service beanstalkd start
before_script:
- psql -c "CREATE DATABASE pyspider_test_taskdb ENCODING 'UTF8' TEMPLATE=template0;" -U postgres
- psql -c "CREATE DATABASE pyspider_test_projectdb ENCODING 'UTF8' TEMPLATE=template0;" -U postgres
- psql -c "CREATE DATABASE pyspider_test_resultdb ENCODING 'UTF8' TEMPLATE=template0;" -U postgres
install:
- pip install --allow-all-external -e .[all,test]
- pip install coveralls
script:
- coverage run setup.py test
after_success:
Expand Down
53 changes: 21 additions & 32 deletions tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,47 +525,36 @@ def tearDownClass(self):
del self.resultdb


#@unittest.skipIf(os.environ.get('IGNORE_POSTGRESQL'), 'no postgresql server for test.')
#class TestPGTaskDB(TaskDBCase, unittest.TestCase):

#@classmethod
#def setUpClass(self):
#self.taskdb = database.connect_database(
#'sqlalchemy+postgresql+taskdb://[email protected]:5432/pyspider_test_taskdb'
#)

#@classmethod
#def tearDownClass(self):
#self.taskdb._execute('DROP DATABASE pyspider_test_taskdb')
@unittest.skipIf(os.environ.get('IGNORE_POSTGRESQL'), 'no postgresql server for test.')
class TestPGTaskDB(TaskDBCase, unittest.TestCase):

@classmethod
def setUpClass(self):
self.taskdb = database.connect_database(
'sqlalchemy+postgresql+taskdb://[email protected]:5432/pyspider_test_taskdb'
)

#@unittest.skipIf(os.environ.get('IGNORE_POSTGRESQL'), 'no postgresql server for test.')
#class TestPGProjectDB(ProjectDBCase, unittest.TestCase):

@unittest.skipIf(os.environ.get('IGNORE_POSTGRESQL'), 'no postgresql server for test.')
class TestPGProjectDB(ProjectDBCase, unittest.TestCase):

#@classmethod
#def setUpClass(self):
#self.projectdb = database.connect_database(
#'sqlalchemy+postgresql+taskdb://[email protected]:5432/pyspider_test_projectdb'
#)

#@classmethod
#def tearDownClass(self):
#self.projectdb._execute('DROP DATABASE pyspider_test_projectdb')
@classmethod
def setUpClass(self):
self.projectdb = database.connect_database(
'sqlalchemy+postgresql+projectdb://[email protected]:5432/pyspider_test_projectdb'
)


#@unittest.skipIf(os.environ.get('IGNORE_POSTGRESQL'), 'no postgresql server for test.')
#class TestPGResultDB(ResultDBCase, unittest.TestCase):
@unittest.skipIf(os.environ.get('IGNORE_POSTGRESQL'), 'no postgresql server for test.')
class TestPGResultDB(ResultDBCase, unittest.TestCase):

#@classmethod
#def setUpClass(self):
#self.resultdb = database.connect_database(
#'sqlalchemy+postgresql+taskdb://[email protected]:5432/pyspider_test_resultdb'
#)
@classmethod
def setUpClass(self):
self.resultdb = database.connect_database(
'sqlalchemy+postgresql+resultdb://[email protected]/pyspider_test_resultdb'
)

#@classmethod
#def tearDownClass(self):
#self.resultdb._execute('DROP DATABASE pyspider_test_resultdb')

@unittest.skipIf(os.environ.get('IGNORE_REDIS'), 'no redis server for test.')
class TestRedisTaskDB(TaskDBCase, unittest.TestCase):
Expand Down

0 comments on commit 23f2466

Please sign in to comment.