Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ steps:
- black --config black.toml --check ./rdflib || true
- flake8 --exit-zero rdflib
- mypy --show-error-context --show-error-codes rdflib
- PYTHONWARNINGS=default nosetests --with-timer --timer-top-n 42 --with-coverage --cover-tests --cover-package=rdflib
- coverage report --skip-covered
- pytest --cov
- coveralls

---
Expand All @@ -49,9 +48,9 @@ steps:
- 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
- black --config black.toml --check ./rdflib || true
- flake8 --exit-zero rdflib
- PYTHONWARNINGS=default nosetests --with-timer --timer-top-n 42
- pytest

---
kind: pipeline
Expand All @@ -69,6 +68,6 @@ steps:
- 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
- black --config black.toml --check ./rdflib || true
- flake8 --exit-zero rdflib
- PYTHONWARNINGS=default nosetests --with-timer --timer-top-n 42
- pytest
148 changes: 140 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,153 @@
RDFLib.sublime-project
/docs/_build/
nosetests.xml
RDFLib.sublime-workspace
*.egg-info/
coverage/
dist/
__pycache__/
*.pyc
/.hgtags
/.hgignore
build/
/.coverage
/.tox/
/docs/draft/
*~
test_reports/*latest.ttl
# PyCharm
.idea/
prepare_changelog.sh
.venv/
#### vimdiff <(curl --silent -L https://github.com/github/gitignore/raw/master/Python.gitignore) .gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

47 changes: 0 additions & 47 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ include ez_setup.py
include skiptests.list
recursive-include rdflib *.py
recursive-include examples *.py
include run_tests.py
graft test
graft docs
prune docs/_build
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,18 @@ Multiple other projects are contained within the RDFlib "family", see <https://g

### Running the tests on the host

Run the test suite with `nose`.
Run the test suite with `pytest`.
```shell
nosetests
pytest
```

### Running test coverage on the host with coverage report

Run the test suite and generate a HTML coverage report with `nose` and `coverage`.
Run the test suite and generate a HTML coverage report with `pytest` and `pytest-cov`.
```shell
nosetests --with-timer --timer-top-n 42 --with-coverage --cover-tests --cover-package=rdflib
pytest --cov
```

There is also a script, `run_tests.py` to run everything.

### Running the tests in a Docker container

Run the test suite inside a Docker container for cross-platform support. This resolves issues such as installing BerkeleyDB on Windows and avoids the host and port issues on macOS.
Expand All @@ -199,7 +197,8 @@ make coverage

Once tests have produced HTML output of the coverage report, view it by running:
```shell
python -m http.server --directory=cover
pytest --cov --cov-report term --cov-report html
python -m http.server --directory=htmlcov
```

## Contributing
Expand Down
9 changes: 6 additions & 3 deletions docker-compose.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ services:
dockerfile: test/Dockerfile
volumes:
- .:/rdflib
command: ["/rdflib/run_tests.sh"]
working_dir: /rdflib
command: ["pytest"]

test-runner-coverage:
build:
context: .
dockerfile: test/Dockerfile
volumes:
- .:/rdflib
command: ["/rdflib/run_tests_with_coverage_report.sh"]
working_dir: /rdflib
command: ["pytest", "--cov"]

check-types:
build:
context: .
dockerfile: test/Dockerfile
volumes:
- .:/rdflib
command: ["python", "-m", "mypy", "--show-error-context", "--show-error-codes" ,"/rdflib/rdflib"]
working_dir: /rdflib
command: ["python", "-m", "mypy", "--show-error-context", "--show-error-codes" ,"rdflib"]
18 changes: 8 additions & 10 deletions docs/developers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,19 @@ If you add a new cool feature, consider also adding an example in ``./examples``

Running tests
-------------
Run tests with `nose <https://nose.readthedocs.org/en/latest/>`_:
Run tests with `pytest <https://docs.pytest.org/en/latest/>`_:

.. code-block:: bash

$ pip install nose
$ python run_tests.py
$ python run_tests.py --attr known_issue # override attr in setup.cfg to run only tests marked with "known_issue"
$ python run_tests.py --attr \!known_issue # runs all tests (including "slow" and "non_core") except those with known issues
$ python run_tests.py --attr slow,!known_issue # comma separate if you want to specify more than one attr
$ python run_tests.py --attr known_issue=None # use =None instead of \! if you keep forgetting to escape the ! in shell commands ;)
$ pip install -r requirements.txt -r requirements.dev.txt
$ pytest

Specific tests can either be run by module name or file name. For example::

$ python run_tests.py --tests rdflib.graph
$ python run_tests.py --tests test/test_graph.py
Specific tests can be run by file name. For example:

.. code-block:: bash

$ pytest test/test_graph.py

Running static checks
---------------------
Expand Down
11 changes: 0 additions & 11 deletions rdflib/extras/external_graph_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,3 @@ def rdflib_to_graphtool(
for epn, eprop in eprops:
eprop[e] = tmp_props[epn]
return g


if __name__ == "__main__":
import sys
import logging.config

logging.basicConfig(level=logging.DEBUG)

import nose

nose.run(argv=[sys.argv[0], sys.argv[0], "-v", "--without-doctest"])
2 changes: 1 addition & 1 deletion rdflib/plugins/parsers/notation3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@ def hexify(ustr):
corresponding to the given UTF8 string

>>> hexify("http://example/a b")
%(b)s'http://example/a%%20b'
b'http://example/a%20b'

"""
# s1=ustr.encode('utf-8')
Expand Down
16 changes: 9 additions & 7 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
sphinx
sphinxcontrib-apidoc
nose==1.3.7
nose-timer
coverage
flake8
doctest-ignore-unicode==0.1.2
berkeleydb
black==21.9b0
coverage
doctest-ignore-unicode==0.1.2
flake8
flake8-black
html5lib
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

html5lib is added because it is in setup.py requirements for tests and it is actually being used in one place in rdflib though I don't think it is actually used by tests. Fine to remove it also.

mypy
pytest
pytest-cov
pytest-subtests
sphinx
sphinxcontrib-apidoc
types-setuptools
Loading