Git Product home page Git Product logo

Comments (5)

tomchadwin avatar tomchadwin commented on August 22, 2024

I think this is now working. The out-of-the-box tests from the Plugin Builder are now running and passing. Next step is to write specific tests for the plugin itself - that's #16.

from gridref-qgis.

tomchadwin avatar tomchadwin commented on August 22, 2024

We can also add in other things to the Travis config, like running pycodestyle which checks the 'quality' of your Python (specifically, its conformance to PEP8 guidelines: https://www.python.org/dev/peps/pep-0008/).

from gridref-qgis.

tomchadwin avatar tomchadwin commented on August 22, 2024

For info, here's a brief breakdown of the Travis config:

# I couldn't get it to work with language: python, hence:
language: generic

# with this set-up, sudo is required for the pip installs
sudo: required

# Trusty is the newest Ubuntu version on Travis
dist: trusty

# Giving two values to the same environment variable means that the tests run once for each value.
# In this case, this means we can test the plugin against QGIS 2.14 (LTR) and 2.18 (latest)
env:
  - QGIS_REPO=http://qgis.org/debian-ltr
  - QGIS_REPO=http://qgis.org/debian

# Can't remember why this is required - it installs some packages which are needed.
addons: 
  apt: 
    packages: 
      - python-software-properties 

# update your repo
-before_install:
  - sudo apt-get -qq -y update

install:
# This is where each of the env vars is used, so first the QGIS LTR repo is added, and on the next
# test run, 2.18 is added
  - sudo add-apt-repository ${QGIS_REPO}

# update your repos
  - sudo apt-get update

# install QGIS, the QGIS Python bindings, and xvfb, which is a virtual display, meaning we can run
# tests for a GUI-based program when we have no video output
  - sudo apt-get install -y --force-yes qgis python-qgis xvfb

# install pip to allow installation of Python modules
  - sudo -H pip install --upgrade pip

# nose is what runs all the tests in one go
  - sudo -H pip install nose

# adds colour to the nose output (optional)
  - sudo -H pip install rednose

# This section prepares the environment for running QGIS and finding the location where Travis
# downloaded your plugin from Github
before_script:
  - echo "Build starting on " `date`
  - export QGIS_PREFIX_PATH=/usr
  - export PYTHONPATH=${QGIS_PREFIX_PATH}/share/qgis/python/:${QGIS_PREFIX_PATH}/share/qgis/python/plugins:`pwd`
  - echo "PYTHONPATH:" $PYTHONPATH
  - export LD_LIBRARY_PATH=${QGIS_PREFIX_PATH}/lib

# I can't remember why we set QGIS_DEBUG to 0
# xvfb runs everything with the virtual video specified for output
# nosestests runs all the tests
script:
  - QGIS_DEBUG=0 xvfb-run --server-args="-screen 0, 1024x768x24" nosetests -s --nologcapture -A 'not slow' -v --rednose --verbose 

# hopefully self-explanatory
notifications:
  email:
    - [email protected]
  webhooks:
    on_success: change  # options: [always|never|change] default: always
    on_failure: always  # options: [always|never|change] default: always
    on_start: never     # options: [always|never|change] default: always

from gridref-qgis.

mtravis avatar mtravis commented on August 22, 2024

from gridref-qgis.

tomchadwin avatar tomchadwin commented on August 22, 2024

The other thing which can be added in is a code coverage check, via a Python module and a service such as Coveralls: https://coveralls.io/github/tomchadwin/qgis2web

from gridref-qgis.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.