Repository: G-Node/python-odml (language: python)

Issue:
Dependency issues on setup install
When installing the package using `python setup.py install`, the package can be installed and imported, but running the tests or using SPARQL specific features of odml results in an `AttributeError`:

```
----> 1 from rdflib.plugins import sparql

~/Chaos/software/miniconda3/envs/py38/lib/python3.8/site-packages/rdflib/plugins/sparql/__init__.py in <module>
     33 
     34 
---> 35 from . import parser
     36 from . import operators
     37 from . import parserutils

~/Chaos/software/miniconda3/envs/py38/lib/python3.8/site-packages/rdflib/plugins/sparql/parser.py in <module>
    180 # [140] PNAME_NS ::= PN_PREFIX? ':'
    181 PNAME_NS = Optional(
--> 182     Param('prefix', PN_PREFIX)) + Suppress(':').leaveWhitespace()
    183 
    184 # [173] PN_LOCAL_ESC ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )

~/Chaos/software/miniconda3/envs/py38/lib/python3.8/site-packages/rdflib/plugins/sparql/parserutils.py in __init__(self, name, expr, isList)
    111     """
    112     def __init__(self, name, expr, isList=False):
--> 113         self.name = name
    114         self.isList = isList
    115         TokenConverter.__init__(self, expr)

AttributeError: can't set attribute
```

This is due to the fact, that `setup.py install` in comparison to `pip install` pulls down pre-releases as well. In this case it pulls down a pre-release of the `pyparsing` package, that currently elicits the above described error.

To make sure odml is correctly installed independent of installation method, the version of `pyparsing` needs to be pinned to version `2.4.7` until this issue is resolved.



Discussion / hints:

Fix patch:
diff --git a/.travis.yml b/.travis.yml
index 487d83c6..bdf94e2b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,26 +4,10 @@ dist: trusty
 language: python
 
 matrix:
-  allow_failures:
-    - os: linux
-      python: "3.9-dev"
-      dist: bionic
-
   include:
-    - os: linux
-      python: "3.5"
-    - os: linux
-      python: "3.6"
-      env: COVERALLS=1
-    - os: linux
-      python: "3.7"
-      dist: xenial
     - os: linux
       python: "3.8"
       dist: xenial
-    - os: linux
-      python: "3.9-dev"
-      dist: bionic
 
 install:
   - export PYVER=${TRAVIS_PYTHON_VERSION:0:1}
diff --git a/README.md b/README.md
index 0e212df7..c68ca9d4 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![Travis build](https://travis-ci.org/G-Node/python-odml.svg?branch=master)](https://travis-ci.org/G-Node/python-odml)
+[![gh actions tests](https://github.com/G-Node/python-odml/workflows/run-tests/badge.svg?branch=master)](https://github.com/G-Node/python-odml/actions)
 [![Build status](https://ci.appveyor.com/api/projects/status/br7pe6atlwdg5618/branch/master?svg=true)](https://ci.appveyor.com/project/G-Node/python-odml/branch/master)
 [![Test coverage](https://coveralls.io/repos/github/G-Node/python-odml/badge.svg?branch=master)](https://coveralls.io/github/G-Node/python-odml)
 [![PyPI version](https://img.shields.io/pypi/v/odml.svg)](https://pypi.org/project/odML/)
diff --git a/setup.py b/setup.py
index 0250e7fa..bcde0035 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,5 @@
 import json
 import os
-import sys
 
 try:
     from setuptools import setup
@@ -30,12 +29,11 @@
 with open('README.md') as f:
     description_text = f.read()
 
-install_req = ["lxml", "pyyaml>=5.1", "rdflib", "docopt", "pathlib"]
+# pyparsing needs to be pinned to 2.4.7 for the time being. setup install fetches a pre-release
+# package that currently results in issues with the rdflib library.
+install_req = ["lxml", "pyyaml>=5.1", "rdflib", "docopt", "pathlib", "pyparsing==2.4.7"]
 
-tests_req = ["owlrl", "requests"]
-
-if sys.version_info < (3, 4):
-    install_req += ["enum34"]
+tests_req = ["pytest", "owlrl", "requests"]
 
 setup(
     name='odML',


Test patch:
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
new file mode 100644
index 00000000..a218ba24
--- /dev/null
+++ b/.github/workflows/run-tests.yml
@@ -0,0 +1,55 @@
+name: run-tests
+on:
+  # test cron by running it once a day at 01:00
+  schedule:
+  - cron:  '0 1 * * *'
+  push:
+    branches:
+      - master
+      - dev
+  pull_request:
+    branches:
+      - master
+jobs:
+  tests:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest, macos-latest, windows-latest]
+        python-version: [3.6, 3.7, 3.8, 3.9]
+    steps:
+      - uses: actions/checkout@v2
+      - name: Setup Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Display Python version
+        run: python -c "import sys; print(sys.version)"
+      - name: Install dependencies
+        run: |
+          python setup.py install
+          pip install -r requirements-test.txt
+      - name: Run tests
+        run: pytest
+  run-coverall:
+    runs-on: [ubuntu-latest]
+    steps:
+      - uses: actions/checkout@v2
+      - name: Setup Python 3.8
+        uses: actions/setup-python@v2
+        with:
+          python-version: "3.8"
+      - name: Display Python version
+        run: python -c "import sys; print(sys.version)"
+      - name: Install dependencies
+        run: |
+          python setup.py install
+          pip install -r requirements-test.txt
+          pip install pytest coveralls
+      - name: Create coverage
+        run: |
+          coverage run --source=odml -m pytest test/
+      - name: Submit to coveralls
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        run: coveralls --service=github
diff --git a/requirements-test.txt b/requirements-test.txt
new file mode 100644
index 00000000..912ca7b1
--- /dev/null
+++ b/requirements-test.txt
@@ -0,0 +1,3 @@
+pytest
+owlrl
+requests