Skip to content

Commit

Permalink
workflows, tests and requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinoMensio committed Feb 24, 2023
1 parent 2a6dc75 commit 5c5802c
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/scripts/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e

echo "Running tests..."
python -m pytest
echo "Tests passed!"
25 changes: 25 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v3
- name: python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install Python dependencies
uses: py-actions/py-dependency-install@v4
- name: Run pytest
run: ./.github/scripts/run-tests.sh
shell: bash
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ The spans produced have the following properties:

## Installation

This package works with SpaCy v3
This package works with:
- python 3.7/3.8/3.9/3.10/3.11
- spaCy>=3.0.0,<4.0.0, last tested on version 3.5

With pip: `pip install spacy-dbpedia-spotlight`

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ twine
pylint
pytest
autopep8
pytest
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ author_email = [email protected]

[options]
install_requires =
spacy>=3
spacy>=3.0.0,<4.0.0
loguru

[options.entry_points]
Expand Down
17 changes: 17 additions & 0 deletions tests/test_load_nlp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import spacy

def test_basic_load():
nlp = spacy.blank("en")
p = nlp.add_pipe('dbpedia_spotlight')
assert p != None
assert 'dbpedia_spotlight' in nlp.pipe_names

def test_load_vector():
nlp = spacy.blank("en")
p = nlp.add_pipe('dbpedia_spotlight')
assert p != None
assert 'dbpedia_spotlight' in nlp.pipe_names
doc = nlp("Google LLC is an American multinational technology company.")
ents = doc.ents
assert ents is not None
assert len(ents) > 0

0 comments on commit 5c5802c

Please sign in to comment.