Skip to content

Commit

Permalink
[travis/tox] Restructuring configuration (apache#4552)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-bodley authored and michellethomas committed May 23, 2018
1 parent 17ade63 commit a2f282a
Show file tree
Hide file tree
Showing 13 changed files with 177 additions and 189 deletions.
30 changes: 15 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
language: python
services:
- mysql
- postgres
- redis-server
cache:
directories:
- $HOME/.wheelhouse/
- pip
env:
global:
- TRAVIS_CACHE=$HOME/.travis_cache/
matrix:
- TOX_ENV=flake8
- TOX_ENV=javascript
- TOX_ENV=pylint
- TOX_ENV=py34-postgres
- TOX_ENV=py34-sqlite
- TOX_ENV=py27-mysql
- TOX_ENV=py27-sqlite
- TOXENV=javascript
- TOXENV=py27-flake8
- TOXENV=py27-mysql
- TOXENV=py27-sqlite
- TOXENV=py27-pylint
- TOXENV=py34-flake8
- TOXENV=py34-postgres
- TOXENV=py34-pylint
- TOXENV=py34-sqlite
before_script:
- mysql -u root -e "DROP DATABASE IF EXISTS superset; CREATE DATABASE superset DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci"
- mysql -u root -e "CREATE USER 'mysqluser'@'localhost' IDENTIFIED BY 'mysqluserpassword';"
- mysql -u root -e "GRANT ALL ON superset.* TO 'mysqluser'@'localhost';"
- psql -U postgres -c "CREATE DATABASE superset;"
- psql -U postgres -c "CREATE USER postgresuser WITH PASSWORD 'pguserpassword';"
- export PATH=${PATH}:/tmp/hive/bin
install:
- pip install --upgrade pip
- pip install codecov tox tox-travis
script: tox -e $TOX_ENV
- pip install codecov tox
script:
- tox
after_success:
- codecov
57 changes: 32 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,18 @@ meets these guidelines:

1. The pull request should include tests, either as doctests,
unit tests, or both.
2. Run `npm run lint` and resolve all errors. Run `npm run test` and
resolve all test failures.
3. Check code coverage by running the following commands in the `assets`
directory. Run `npm run cover` to check code coverage on `.js` work, and
run `nosetests --with-coverage` to check code coverage on `.py` work. You
may have to first run `pip install nose coverage`.
4. If the pull request adds functionality, the docs should be updated
2. Run `tox` and resolve all errors and test failures.
3. If the pull request adds functionality, the docs should be updated
as part of the same PR. Doc string are often sufficient, make
sure to follow the sphinx compatible standards.
5. The pull request should work for Python 2.7, and ideally python 3.4+.
4. The pull request should work for Python 2.7, and ideally Python 3.4+.
``from __future__ import`` will be required in every `.py` file soon.
6. Code will be reviewed by re running the unittests, flake8 and syntax
should be as rigorous as the core Python project.
7. Please rebase and resolve all conflicts before submitting.
5. If the pull request adds a Python dependency include it in `setup.py`
denoting any specific restrictions and in `requirements.txt` pinned to a
specific version which ensures that the application build is deterministic.
6. Please rebase and resolve all conflicts before submitting.
7. Please ensure the necessary checks pass and that code coverage does not
decrease.
8. If you are asked to update your pull request with some changes there's
no need to create a new one. Push your changes to the same branch.

Expand Down Expand Up @@ -108,7 +106,7 @@ Finally, to make changes to the rst files and build the docs using Sphinx,
you'll need to install a handful of dependencies from the repo you cloned:

cd incubator-superset
pip install -r dev-reqs-for-docs.txt
pip install -r docs/requirements-docs.txt

To get the feel for how to edit and build the docs, let's edit a file, build
the docs and see our changes in action. First, you'll want to
Expand Down Expand Up @@ -183,6 +181,7 @@ Check the [OS dependencies](https://superset.incubator.apache.org/installation.h
source env/bin/activate

# install for development
pip install -r requirements.txt
pip install -e .

# Create an admin user
Expand Down Expand Up @@ -270,21 +269,28 @@ npm run dev
Should you add or upgrade a npm package, which involves changing `package.json`, you'll need to re-run `yarn install` and push the newly generated `yarn.lock` file so we get the reproducible build. More information at (https://yarnpkg.com/blog/2016/11/24/lockfiles-for-all/)

## Testing
All tests are carried out in [tox](http://tox.readthedocs.io/en/latest/index.html)
a standardized testing framework mostly for Python (though we also used it for Javascript).
All python tests can be run with any of the tox [environments](http://tox.readthedocs.io/en/latest/example/basic.html#a-simple-tox-ini-default-environments), via,

Before running python unit tests, please setup local testing environment:
```
pip install -r dev-reqs.txt
```
tox -e <environment>

i.e.,

All python tests can be run with:
tox -e py27
tox -e py34

./run_tests.sh
Alternatively, you can run all tests in a single file via,

Alternatively, you can run a specific test with:
tox -e <environment> -- tests/test_file.py

./run_specific_test.sh tests.core_tests:CoreTests.test_function_name
or for a specific test via,

Note that before running specific tests, you have to both setup the local testing environment and run all tests.
tox -e <environment> -- tests/test_file.py:TestClassName.test_method_name

Note that the test environment uses a temporary directory for defining the
SQLite databases which will be cleared each time before the group of test
commands are invoked.

We use [Mocha](https://mochajs.org/), [Chai](http://chaijs.com/) and [Enzyme](http://airbnb.io/enzyme/) to test Javascript. Tests can be run with:

Expand All @@ -297,16 +303,17 @@ We use [Mocha](https://mochajs.org/), [Chai](http://chaijs.com/) and [Enzyme](ht
Lint the project with:

# for python
flake8
tox -e flake8

# for javascript
npm run lint
tox -e eslint

## API documentation

Generate the documentation with:

cd docs && ./build.sh
pip install -r docs/requirements.txt
python setup.py build_sphinx

## CSS Themes
As part of the npm build process, CSS for Superset is compiled from `Less`, a dynamic stylesheet language.
Expand Down Expand Up @@ -400,7 +407,7 @@ https://github.com/apache/incubator-superset/pull/3013
.. code::

# install doc dependencies
pip install -r dev-reqs-for-docs.txt
pip install -r docs/requirements.txt

# build the docs
python setup.py build_sphinx
Expand Down
3 changes: 0 additions & 3 deletions dev-reqs-for-docs.txt

This file was deleted.

14 changes: 0 additions & 14 deletions dev-reqs.txt

This file was deleted.

3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sphinx==1.7.1
sphinx-rtd-theme==0.2.4
sphinxcontrib.youtube==0.1.2
2 changes: 0 additions & 2 deletions pylint-errors.sh

This file was deleted.

7 changes: 7 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
flask-cors==3.0.3
ipdb==0.11
mysqlclient==1.3.12
psycopg2==2.7.4
redis==2.10.6
statsd==3.2.2
tox==2.9.1
40 changes: 40 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
bleach==2.1.2
boto3==1.4.7
celery==4.1.0
colorama==0.3.9
cryptography==1.9
flask==0.12.2
flask-appbuilder==1.10.0
flask-cache==0.13.1
flask-compress==1.4.0
flask-migrate==2.1.1
flask-script==2.0.6
flask-sqlalchemy==2.1
flask-testing==0.7.1
flask-wtf==0.14.2
flower==0.9.2
future==0.16.0
geopy==1.11.0
gunicorn==19.7.1
humanize==0.5.1
idna==2.6
markdown==2.6.11
pandas==0.22.0
parsedatetime==2.0.0
pathlib2==2.3.0
polyline==1.3.2
pydruid==0.4.1
pyhive==0.5.0
python-dateutil==2.6.1
python-geohash==0.8.5
pyyaml==3.12
requests==2.18.4
simplejson==3.13.2
six==1.11.0
sqlalchemy==1.2.2
sqlalchemy-utils==0.32.21
sqlparse==0.2.4
thrift==0.11.0
thrift-sasl==0.3.0
unicodecsv==0.14.1
unidecode==1.0.22
12 changes: 0 additions & 12 deletions run_tests.sh

This file was deleted.

16 changes: 8 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ license = Apache License, Version 2.0
packages = superset

[build_sphinx]
source-dir = docs/
build-dir = docs/_build
all_files = 1
source-dir = docs
build-dir = docs/_build
all_files = 1

[upload_sphinx]
upload-dir = docs/_build/html

[nosetests]
verbosity=3
detailed-errors=1
with-coverage=1
nocapture=1
cover-package=superset
verbosity = 3
detailed-errors = 1
with-coverage = 1
nocapture = 1
cover-package = superset
76 changes: 35 additions & 41 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,56 +50,50 @@ def get_git_sha():
zip_safe=False,
scripts=['superset/bin/superset'],
install_requires=[
'bleach',
'boto3>=1.4.6',
'celery==4.1.0',
'colorama==0.3.9',
'cryptography==1.9',
'flask==0.12.2',
'flask-appbuilder==1.10.0',
'flask-cache==0.13.1',
'flask-migrate==2.1.1',
'flask-script==2.0.6',
'flask-compress==1.4.0',
'flask-sqlalchemy==2.1',
'flask-testing==0.7.1',
'flask-wtf==0.14.2',
'flower==0.9.2', # deprecated
'celery',
'colorama',
'cryptography',
'flask',
'flask-appbuilder',
'flask-cache',
'flask-compress',
'flask-migrate',
'flask-script',
'flask-sqlalchemy',
'flask-testing',
'flask-wtf',
'flower', # deprecated
'future>=0.16.0, <0.17',
'geopy==1.11.0',
'python-geohash==0.8.5',
'humanize==0.5.1',
'gunicorn==19.7.1', # deprecated
'idna==2.6',
'markdown==2.6.11',
'pandas==0.22.0',
'parsedatetime==2.0.0',
'pathlib2==2.3.0',
'polyline==1.3.2',
'pydruid==0.4.1',
'PyHive>=0.4.0',
'python-dateutil==2.6.1',
'geopy',
'gunicorn', # deprecated
'humanize',
'idna',
'markdown',
'pandas',
'parsedatetime',
'pathlib2',
'polyline',
'pydruid',
'pyhive>=0.4.0',
'python-dateutil',
'python-geohash',
'pyyaml>=3.11',
'requests==2.18.4',
'simplejson==3.13.2',
'six==1.11.0',
'sqlalchemy==1.2.2',
'sqlalchemy-utils==0.32.21',
'sqlparse==0.2.4',
'requests',
'simplejson',
'six',
'sqlalchemy',
'sqlalchemy-utils',
'sqlparse',
'thrift>=0.9.3',
'thrift-sasl>=0.2.1',
'unicodecsv',
'unidecode>=0.04.21',
'unicodecsv==0.14.1',
'bleach==2.1.2',
],
extras_require={
'cors': ['Flask-Cors>=2.0.0'],
'cors': ['flask-cors>=2.0.0'],
},
tests_require=[
'coverage',
'mock',
'nose',
'redis',
],
author='Maxime Beauchemin',
author_email='[email protected]',
url='https://github.com/apache/incubator-superset',
Expand Down
1 change: 0 additions & 1 deletion tests/base_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class SupersetTestCase(unittest.TestCase):
def __init__(self, *args, **kwargs):
if (
self.requires_examples and
not os.environ.get('SOLO_TEST') and
not os.environ.get('examples_loaded')
):
logging.info('Loading examples')
Expand Down
Loading

0 comments on commit a2f282a

Please sign in to comment.