From 9297e65eac6dd8e97a8739b1c4419db74f9cb03d Mon Sep 17 00:00:00 2001 From: Graham Higgins Date: Fri, 24 Dec 2021 16:49:49 +0000 Subject: [PATCH 1/2] Fix `self.line` typos in call to BadSyntax. Fix for issue #821 Invalid URI crashes without BadSyntax error --- rdflib/plugins/parsers/notation3.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rdflib/plugins/parsers/notation3.py b/rdflib/plugins/parsers/notation3.py index 2bd856887..64e4a7f04 100755 --- a/rdflib/plugins/parsers/notation3.py +++ b/rdflib/plugins/parsers/notation3.py @@ -1362,7 +1362,7 @@ def qname(self, argstr, i, res): if c not in escapeChars: raise BadSyntax( self._thisDoc, - self.line, + self.lines, argstr, i, "illegal escape " + c, @@ -1374,7 +1374,7 @@ def qname(self, argstr, i, res): ): raise BadSyntax( self._thisDoc, - self.line, + self.lines, argstr, i, "illegal hex escape " + c, @@ -1386,7 +1386,7 @@ def qname(self, argstr, i, res): if lastslash: raise BadSyntax( - self._thisDoc, self.line, argstr, i, "qname cannot end with \\" + self._thisDoc, self.lines, argstr, i, "qname cannot end with \\" ) if argstr[i - 1] == ".": From 974a41a81674334ca94b27709afa7f65370d5d59 Mon Sep 17 00:00:00 2001 From: Iwan Aucamp Date: Mon, 27 Dec 2021 23:10:42 +0100 Subject: [PATCH 2/2] Scale down CI checks Only perform tests for networkx, berkeleydb and fuseki on Linux using Python 3.7. Also: - include python 3.10 in github test matrix. - move networkx and berkeleydb to `requirements.dev-extra.txt` so they can be installed seperately and add information about this to `developers.rst`. --- .drone.yml | 10 ++++------ .github/workflows/validate.yaml | 34 +++++++++++++++++++++------------ docs/developers.rst | 15 +++++++++++++-- requirements.dev-extra.txt | 2 ++ requirements.dev.txt | 1 - 5 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 requirements.dev-extra.txt diff --git a/.drone.yml b/.drone.yml index 8a02ce450..ee23e9487 100644 --- a/.drone.yml +++ b/.drone.yml @@ -24,6 +24,7 @@ steps: - apt-get update && apt-get install -y openjdk-11-jdk-headless - pip install --default-timeout 60 -r requirements.txt - pip install --default-timeout 60 -r requirements.dev.txt + - pip install --default-timeout 60 -r requirements.dev-extra.txt - pip install --default-timeout 60 coveralls && export HAS_COVERALLS=1 - python setup.py install - black --config black.toml --check ./rdflib || true @@ -44,13 +45,12 @@ steps: - name: test image: python:3.8 commands: - - apt-get update && apt-get install -y openjdk-11-jdk-headless - pip install --default-timeout 60 -r requirements.txt - pip install --default-timeout 60 -r requirements.dev.txt - python setup.py install - black --config black.toml --check ./rdflib || true - flake8 --exit-zero rdflib - - ./with-fuseki.sh pytest -ra + - pytest -ra --- kind: pipeline @@ -64,13 +64,12 @@ steps: - name: test image: python:3.9 commands: - - apt-get update && apt-get install -y openjdk-11-jdk-headless - pip install --default-timeout 60 -r requirements.txt - pip install --default-timeout 60 -r requirements.dev.txt - python setup.py install - black --config black.toml --check ./rdflib || true - flake8 --exit-zero rdflib - - ./with-fuseki.sh pytest -ra + - pytest -ra --- kind: pipeline @@ -84,10 +83,9 @@ steps: - name: test image: python:3.10 commands: - - apt-get update && apt-get install -y openjdk-11-jdk-headless - pip install --default-timeout 60 -r requirements.txt - pip install --default-timeout 60 -r requirements.dev.txt - python setup.py install - black --config black.toml --check ./rdflib | true - flake8 --exit-zero rdflib - - ./with-fuseki.sh pytest -ra + - pytest -ra diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 5e231f642..bbc09fb1b 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -16,17 +16,23 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9"] + python-version: ["3.7", "3.8", "3.9", "3.10"] os: [ubuntu-latest, macos-latest, windows-latest] + include: + - { + python-version: "3.7", + os: ubuntu-latest, + extensive-tests: true, + } steps: - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - uses: actions/setup-java@v2 + if: ${{ matrix.extensive-tests }} with: distribution: "temurin" java-version: "17" @@ -55,8 +61,13 @@ jobs: - name: Install dependencies shell: bash run: | - # bash .travis.fuseki_install_optional.sh pip install --default-timeout 60 -r requirements.txt + pip install --default-timeout 60 -r requirements.dev.txt + python setup.py install + - name: Install extra dev dependencies + if: ${{ matrix.extensive-tests }} + shell: bash + run: | if [ "${{ matrix.os }}" == "ubuntu-latest" ] then sudo apt-get install -y libdb-dev @@ -65,18 +76,17 @@ jobs: brew install berkeley-db@4 export BERKELEYDB_DIR=$(brew --prefix berkeley-db@4) fi - pip install --default-timeout 60 -r requirements.dev.txt - pip install networkx - python setup.py install + pip install --default-timeout 60 -r requirements.dev-extra.txt - name: Validate shell: bash run: | + test_harness=() + if "${{ matrix.extensive-tests || false }}" && [ "${{ matrix.os }}" != "windows-latest" ] + then + 1>&2 echo "Running with fuseki" + test_harness+="./with-fuseki.sh" + fi black --config black.toml --check ./rdflib || true flake8 --exit-zero rdflib mypy --show-error-context --show-error-codes - if [ "${{ matrix.os }}" == "windows-latest" ] - then - pytest -ra --cov - else - ./with-fuseki.sh pytest -ra --cov - fi + "${test_harness[@]}" pytest -ra --cov diff --git a/docs/developers.rst b/docs/developers.rst index 3431ba5c7..be6bb94a1 100644 --- a/docs/developers.rst +++ b/docs/developers.rst @@ -44,17 +44,28 @@ Running tests To run RDFLib's test suite with `pytest `_: -.. code-block:: bash +.. code-block:: console $ pip install -r requirements.txt -r requirements.dev.txt $ pytest Specific tests can be run by file name. For example: -.. code-block:: bash +.. code-block:: console $ pytest test/test_graph.py +For more extensive tests, including tests for the `berkleydb +`_ +backend, install the requirements from ``requirements.dev-extra.txt`` before +executing the tests. + +.. code-block:: console + + $ pip install -r requirements.txt -r requirements.dev.txt + $ pip install -r requirements.dev-extra.txt + $ pytest + Writing tests ~~~~~~~~~~~~~ diff --git a/requirements.dev-extra.txt b/requirements.dev-extra.txt new file mode 100644 index 000000000..cae57fd95 --- /dev/null +++ b/requirements.dev-extra.txt @@ -0,0 +1,2 @@ +berkeleydb +networkx diff --git a/requirements.dev.txt b/requirements.dev.txt index a0d867468..c989384f0 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1,4 +1,3 @@ -berkeleydb; platform_system != "Windows" black==21.9b0 coverage doctest-ignore-unicode==0.1.2