Merge branch 'development'

This commit is contained in:
Roberto Rosario
2016-10-26 04:46:36 -04:00
2 changed files with 36 additions and 11 deletions

View File

@@ -3,8 +3,12 @@ services:
- mysql:latest
- postgres
before_script:
- echo "LC_ALL=\"en_US.UTF-8\"" >> /etc/default/locale
- locale-gen en_US.UTF-8
- update-locale LANG=en_US.UTF-8
- export LC_ALL=en_US.UTF-8
- apt-get update -qq
- apt-get install -qq python-dev python-pip gcc gnupg1 tesseract-ocr tesseract-ocr-deu ghostscript libjpeg-dev libpng-dev libtiff-dev poppler-utils libreoffice
- apt-get install -qq curl python-dev python-pip gcc gnupg1 tesseract-ocr tesseract-ocr-deu ghostscript libjpeg-dev libpng-dev libtiff-dev poppler-utils libreoffice
variables:
POSTGRES_DB: "mayan_edms"
POSTGRES_PASSWORD: "postgres"
@@ -16,7 +20,7 @@ test:mysql:
- pip install -r requirements/testing.txt
- pip install mysql-python
- apt-get install -qq mysql-client
- mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" -e "ALTER DATABASE $MYSQL_DATABASE CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
- mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" -e "set global character_set_server=utf8mb4;"
- coverage run manage.py runtests --settings=mayan.settings.testing.gitlab-ci.db_mysql --nomigrations
- bash <(curl https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov) -t $CODECOV_TOKEN
tags:

View File

@@ -1,5 +1,6 @@
from __future__ import unicode_literals
import glob
import os
import psutil
@@ -32,22 +33,42 @@ class ContentTypeCheckMixin(object):
class TempfileCheckMixin(object):
# Ignore the jvmstat instrumentation and GitLab's CI .config files
ignore_globs = ('hsperfdata_*', '.config')
def _get_temporary_entries(self):
return os.listdir(setting_temporary_directory.value)
ignored_result = []
# Expand globs by joining the temporary directory and then flattening
# the list of lists into a single list
for item in self.ignore_globs:
ignored_result.extend(
glob.glob(
os.path.join(setting_temporary_directory.value, item)
)
)
# Remove the path and leave only the expanded filename
ignored_result = map(lambda x: os.path.split(x)[-1], ignored_result)
return set(
os.listdir(setting_temporary_directory.value)
) - set(ignored_result)
def setUp(self):
super(TempfileCheckMixin, self).setUp()
self._temporary_entries = self._get_temporary_entries()
self._temporary_items = self._get_temporary_entries()
def tearDown(self):
for temporary_entry in self._get_temporary_entries():
self.assertFalse(
temporary_entry not in self._temporary_entries,
msg='Orphan temporary file. The number of temporary file and '
'directories at the start and at the end of the test are not the '
'same.'
final_temporary_items = self._get_temporary_entries()
self.assertEqual(
self._temporary_items, final_temporary_items,
msg='Orphan temporary file. The number of temporary files and/or '
'directories at the start and at the end of the test are not the '
'same. Orphan entries: {}'.format(
','.join(final_temporary_items-self._temporary_items)
)
)
super(TempfileCheckMixin, self).tearDown()