Skip to content

Tests for translateAlgebra are not integrated with other unit tests #1451

@aucampia

Description

@aucampia

As far as I can tell translateAlgebra tests (stuff in test/translate_algebra/...) are not integrated with other unit tests and will not run when run_tests.py or nosetests run.

$ \rm -rv .venv
$ python3.7 -m venv .venv
$ .venv/bin/python3 -m pip install -r requirements.txt -r requirements.dev.txt
$ export PYTHONPATH=$(readlink -f .):$(readlink -f .venv)
$ .venv/bin/python test/translate_algebra/main.py
Traceback (most recent call last):
  File "test/translate_algebra/main.py", line 1, in <module>
    from test_base import Test, TestExecution, format_text
  File "/home/iwana/d.x/github.com/RDFLib/rdflib/test/translate_algebra/test_base.py", line 1, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'
$ .venv/bin/python3 -m pip install pandas
$ .venv/bin/python test/translate_algebra/main.py
Traceback (most recent call last):
  File "test/translate_algebra/main.py", line 1, in <module>
    from test_base import Test, TestExecution, format_text
  File "/home/iwana/d.x/github.com/RDFLib/rdflib/test/translate_algebra/test_base.py", line 5, in <module>
    from tabulate import tabulate
ModuleNotFoundError: No module named 'tabulate'
$ .venv/bin/python3 -m pip install tabulate

Furthermore it seems these tests need pandas and tabulate and seems to be expecting a file test/config.ini with a section TEST

$ .venv/bin/python test/translate_algebra/main.py
Executing tests ...
Traceback (most recent call last):
  File "test/translate_algebra/main.py", line 889, in <module>
    t.run_tests()
  File "/home/iwana/d.x/github.com/RDFLib/rdflib/test/translate_algebra/test_base.py", line 107, in run_tests
    logging.getLogger().setLevel(int(self.test_config.get("TEST", "log_level")))
  File "/usr/lib64/python3.7/configparser.py", line 780, in get
    d = self._unify_values(section, vars)
  File "/usr/lib64/python3.7/configparser.py", line 1146, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'TEST'

test_module_path = os.path.dirname(sys.modules[__class__.__module__].__file__)
config_path = test_module_path + "/../config.ini"
self.test_config = configparser.ConfigParser()
self.test_config.read(config_path)

logging.getLogger().setLevel(int(self.test_config.get("TEST", "log_level")))

Ideally this should be integrated with the rest of the tests, it should run when run_tests.py runs and when drone CI runs, it should also have all dependencies in requirements.dev.txt and it should have all required config files.

The best option would be to base the test system used for translateAlgebra on python's unittest module.

See also:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions