-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to pytest, relocate in subfolder #1813
Conversation
@gjhiggins for me, on master, this was also testing BerkeleyDB, albeit it a bit of an odd way. I don't really like how it was doing it but maybe it is best to keep it, if you are fine with it I will modify your test slightly so it also runs against BerkeleyDB if it is present, as was happening before. $ git show
commit cdaee27415bd669082d90c9b6bbff3191a147761 (HEAD -> master, origin/master, origin/HEAD)
Merge: 8fb71bcf e8c3a0e5
Author: Iwan Aucamp <[email protected]>
Date: Wed Apr 13 18:51:14 2022 +0200
Merge pull request #1801 from aucampia/iwana-20220410T1604-more_variants
Add two xfails related to Example 2 from RDF 1.1 TriG specification
Merging with only one review as this just adds tests within the variant and round trip test harnesses which are parameterized. Some of the added tests are xfails but given that the rest of the tests for the same parameterized harnesses pass it seems likely that the xfail tests are valid.
$ git diff
diff --git a/test/test_graph.py b/test/test_graph.py
index e907fb4c..2468f0e8 100644
--- a/test/test_graph.py
+++ b/test/test_graph.py
@@ -1,3 +1,4 @@
+import logging
import sys
import os
import unittest
@@ -72,6 +73,7 @@ class GraphTestCase(unittest.TestCase):
tmppath = None
def setUp(self):
+ logging.debug("self.store = %s", self.store)
try:
self.graph = Graph(store=self.store)
except ImportError:
$ .venv/bin/python3 -m pytest --log-level DEBUG -rA --tb=native --cov --cov-report=term test/test_graph.py
============================================================================ test session starts ============================================================================
platform linux -- Python 3.9.12, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/iwana/sw/d/github.com/iafork/rdflib.clean, configfile: tox.ini
plugins: subtests-0.7.0, md-report-0.2.0, cov-3.0.0
collected 24 items
test/test_graph.py ........................ [100%]
================================================================================== PASSES ===================================================================================
___________________________________________________________________________ GraphTestCase.testAdd ___________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = default
________________________________________________________________________ GraphTestCase.testConnected ________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = default
________________________________________________________________________ GraphTestCase.testGraphAdd _________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = default
____________________________________________________________________ GraphTestCase.testGraphIntersection ____________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = default
___________________________________________________________________ GraphTestCase.testGuessFormatForParse ___________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = default
_________________________________________________________________________ GraphTestCase.testRemove __________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = default
___________________________________________________________________________ GraphTestCase.testSub ___________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = default
_______________________________________________________________________ GraphTestCase.testTransitive ________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = default
_________________________________________________________________________ GraphTestCase.testTriples _________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = default
_____________________________________________________________________ GraphTestCase.test_parse_file_uri _____________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = default
________________________________________________________________________________ t0.testAdd _________________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = BerkeleyDB
_____________________________________________________________________________ t0.testConnected ______________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = BerkeleyDB
______________________________________________________________________________ t0.testGraphAdd ______________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = BerkeleyDB
_________________________________________________________________________ t0.testGraphIntersection __________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = BerkeleyDB
________________________________________________________________________ t0.testGuessFormatForParse _________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = BerkeleyDB
_______________________________________________________________________________ t0.testRemove _______________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = BerkeleyDB
________________________________________________________________________________ t0.testSub _________________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = BerkeleyDB
_____________________________________________________________________________ t0.testTransitive _____________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = BerkeleyDB
______________________________________________________________________________ t0.testTriples _______________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = BerkeleyDB
__________________________________________________________________________ t0.test_parse_file_uri ___________________________________________________________________________
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
DEBUG root:test_graph.py:76 self.store = BerkeleyDB
---------- coverage: platform linux, python 3.9.12-final-0 -----------
Name Stmts Miss Branch BrPart Cover
--------------------------------------------------------------------------------
rdflib/__init__.py 29 6 2 1 77%
rdflib/collection.py 107 87 34 0 16%
rdflib/compare.py 336 263 183 3 17%
rdflib/compat.py 54 29 14 2 40%
rdflib/container.py 146 116 44 0 21%
rdflib/events.py 34 20 16 1 38%
rdflib/exceptions.py 35 13 16 0 75%
rdflib/extras/__init__.py 0 0 0 0 100%
rdflib/extras/cmdlineutils.py 38 38 12 0 0%
rdflib/extras/describer.py 52 52 10 0 0%
rdflib/extras/external_graph_libs.py 70 70 38 0 0%
rdflib/extras/infixowl.py 1010 1010 553 0 0%
rdflib/graph.py 918 560 424 11 34%
rdflib/namespace/_BRICK.py 1201 0 2 0 100%
rdflib/namespace/_CSVW.py 88 0 2 0 100%
rdflib/namespace/_DC.py 20 0 2 0 100%
rdflib/namespace/_DCAM.py 9 0 2 0 100%
rdflib/namespace/_DCAT.py 40 0 2 0 100%
rdflib/namespace/_DCMITYPE.py 17 0 2 0 100%
rdflib/namespace/_DCTERMS.py 102 0 2 0 100%
rdflib/namespace/_DOAP.py 48 0 2 0 100%
rdflib/namespace/_FOAF.py 80 0 2 0 100%
rdflib/namespace/_GEO.py 43 0 2 0 100%
rdflib/namespace/_ODRL2.py 210 0 2 0 100%
rdflib/namespace/_ORG.py 50 0 2 0 100%
rdflib/namespace/_OWL.py 84 0 2 0 100%
rdflib/namespace/_PROF.py 14 0 2 0 100%
rdflib/namespace/_PROV.py 175 0 2 0 100%
rdflib/namespace/_QB.py 41 0 2 0 100%
rdflib/namespace/_RDF.py 28 0 2 0 100%
rdflib/namespace/_RDFS.py 20 0 2 0 100%
rdflib/namespace/_SDO.py 2771 0 2 0 100%
rdflib/namespace/_SH.py 184 0 2 0 100%
rdflib/namespace/_SKOS.py 37 0 2 0 100%
rdflib/namespace/_SOSA.py 40 0 2 0 100%
rdflib/namespace/_SSN.py 25 0 2 0 100%
rdflib/namespace/_TIME.py 99 0 2 0 100%
rdflib/namespace/_VANN.py 11 0 2 0 100%
rdflib/namespace/_VOID.py 36 0 2 0 100%
rdflib/namespace/_WGS.py 11 0 2 0 100%
rdflib/namespace/_XSD.py 76 0 2 0 100%
rdflib/namespace/__init__.py 396 176 164 17 50%
rdflib/parser.py 262 103 116 21 58%
rdflib/paths.py 210 150 152 1 21%
rdflib/plugin.py 137 15 28 4 85%
rdflib/plugins/__init__.py 0 0 0 0 100%
rdflib/plugins/parsers/RDFVOC.py 14 0 2 0 100%
rdflib/plugins/parsers/__init__.py 0 0 0 0 100%
rdflib/plugins/parsers/hext.py 47 47 30 0 0%
rdflib/plugins/parsers/jsonld.py 320 320 228 0 0%
rdflib/plugins/parsers/notation3.py 1193 499 548 120 53%
rdflib/plugins/parsers/nquads.py 42 42 12 0 0%
rdflib/plugins/parsers/ntriples.py 211 71 86 19 60%
rdflib/plugins/parsers/rdfxml.py 407 120 166 39 66%
rdflib/plugins/parsers/trig.py 97 97 48 0 0%
rdflib/plugins/parsers/trix.py 161 161 74 0 0%
rdflib/plugins/serializers/__init__.py 0 0 0 0 100%
rdflib/plugins/serializers/hext.py 71 71 46 0 0%
rdflib/plugins/serializers/jsonld.py 227 227 149 0 0%
rdflib/plugins/serializers/longturtle.py 203 203 86 0 0%
rdflib/plugins/serializers/n3.py 75 75 30 0 0%
rdflib/plugins/serializers/nquads.py 27 27 14 0 0%
rdflib/plugins/serializers/nt.py 44 44 20 0 0%
rdflib/plugins/serializers/rdfxml.py 211 211 116 0 0%
rdflib/plugins/serializers/trig.py 72 72 36 0 0%
rdflib/plugins/serializers/trix.py 54 54 32 0 0%
rdflib/plugins/serializers/turtle.py 290 290 124 0 0%
rdflib/plugins/serializers/xmlwriter.py 81 81 34 0 0%
rdflib/plugins/shared/__init__.py 0 0 0 0 100%
rdflib/plugins/shared/jsonld/__init__.py 0 0 0 0 100%
rdflib/plugins/shared/jsonld/context.py 361 361 212 0 0%
rdflib/plugins/shared/jsonld/errors.py 5 5 2 0 0%
rdflib/plugins/shared/jsonld/keys.py 22 22 0 0 0%
rdflib/plugins/shared/jsonld/util.py 59 59 32 0 0%
rdflib/plugins/sparql/__init__.py 24 24 10 0 0%
rdflib/plugins/sparql/aggregates.py 163 163 63 0 0%
rdflib/plugins/sparql/algebra.py 763 763 573 0 0%
rdflib/plugins/sparql/datatypes.py 21 21 8 0 0%
rdflib/plugins/sparql/evaluate.py 317 317 193 0 0%
rdflib/plugins/sparql/evalutils.py 77 77 50 0 0%
rdflib/plugins/sparql/operators.py 571 571 246 0 0%
rdflib/plugins/sparql/parser.py 314 314 92 0 0%
rdflib/plugins/sparql/parserutils.py 133 133 76 0 0%
rdflib/plugins/sparql/processor.py 39 39 10 0 0%
rdflib/plugins/sparql/results/__init__.py 0 0 0 0 100%
rdflib/plugins/sparql/results/csvresults.py 46 46 28 0 0%
rdflib/plugins/sparql/results/graph.py 8 8 2 0 0%
rdflib/plugins/sparql/results/jsonresults.py 80 80 50 0 0%
rdflib/plugins/sparql/results/rdfresults.py 36 36 24 0 0%
rdflib/plugins/sparql/results/tsvresults.py 47 47 16 0 0%
rdflib/plugins/sparql/results/txtresults.py 38 38 30 0 0%
rdflib/plugins/sparql/results/xmlresults.py 137 137 52 0 0%
rdflib/plugins/sparql/sparql.py 242 242 90 0 0%
rdflib/plugins/sparql/update.py 151 151 94 0 0%
rdflib/plugins/stores/__init__.py 0 0 0 0 100%
rdflib/plugins/stores/auditable.py 89 89 22 0 0%
rdflib/plugins/stores/berkeleydb.py 441 125 150 29 67%
rdflib/plugins/stores/concurrent.py 64 64 22 0 0%
rdflib/plugins/stores/memory.py 370 148 198 25 55%
rdflib/plugins/stores/regexmatching.py 83 83 36 0 0%
rdflib/plugins/stores/sparqlconnector.py 89 89 30 0 0%
rdflib/plugins/stores/sparqlstore.py 358 358 170 0 0%
rdflib/query.py 172 123 88 1 25%
rdflib/resource.py 112 70 38 0 29%
rdflib/serializer.py 16 8 6 1 50%
rdflib/store.py 143 49 48 2 58%
rdflib/term.py 713 428 391 29 33%
rdflib/tools/__init__.py 0 0 0 0 100%
rdflib/tools/csv2rdf.py 300 300 176 0 0%
rdflib/tools/defined_namespace_creator.py 38 38 14 0 0%
rdflib/tools/graphisomorphism.py 58 58 30 0 0%
rdflib/tools/rdf2dot.py 62 62 22 0 0%
rdflib/tools/rdfpipe.py 82 82 36 0 0%
rdflib/tools/rdfs2dot.py 49 49 22 0 0%
rdflib/util.py 195 146 106 4 18%
rdflib/void.py 76 76 30 0 0%
--------------------------------------------------------------------------------
TOTAL 20405 11519 7331 330 36%
========================================================================== short test summary info ==========================================================================
PASSED test/test_graph.py::TestGraphPT::test_property_store
PASSED test/test_graph.py::TestGraphPT::test_property_identifier_default
PASSED test/test_graph.py::TestGraphPT::test_property_identifier
PASSED test/test_graph.py::TestGraphPT::test_property_namespace_manager
PASSED test/test_graph.py::GraphTestCase::testAdd
PASSED test/test_graph.py::GraphTestCase::testConnected
PASSED test/test_graph.py::GraphTestCase::testGraphAdd
PASSED test/test_graph.py::GraphTestCase::testGraphIntersection
PASSED test/test_graph.py::GraphTestCase::testGuessFormatForParse
PASSED test/test_graph.py::GraphTestCase::testRemove
PASSED test/test_graph.py::GraphTestCase::testSub
PASSED test/test_graph.py::GraphTestCase::testTransitive
PASSED test/test_graph.py::GraphTestCase::testTriples
PASSED test/test_graph.py::GraphTestCase::test_parse_file_uri
PASSED test/test_graph.py::t0::testAdd
PASSED test/test_graph.py::t0::testConnected
PASSED test/test_graph.py::t0::testGraphAdd
PASSED test/test_graph.py::t0::testGraphIntersection
PASSED test/test_graph.py::t0::testGuessFormatForParse
PASSED test/test_graph.py::t0::testRemove
PASSED test/test_graph.py::t0::testSub
PASSED test/test_graph.py::t0::testTransitive
PASSED test/test_graph.py::t0::testTriples
PASSED test/test_graph.py::t0::test_parse_file_uri
============================================================================ 24 passed in 15.93s ============================================================================ |
Merged now: https://github.com/gjhiggins/rdflib/pull/5#issuecomment-1099451440
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good and coverage seems to be close enough, thanks @gjhiggins - will merge this tomorrow if there is no further feedback.
Summary of changes
Refactor into individual functions rather than spurious class methods, remove plugins iterator because it's not really testing the store functionality.
Checklist
so maintainers can fix minor issues and keep your PR up to date.