Skip to content

Commit

Permalink
regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
staffanm committed Nov 14, 2017
1 parent c83486d commit 9848aa6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
10 changes: 5 additions & 5 deletions ferenda/documentrepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -1928,11 +1928,11 @@ def relate_triples(self, basefile, removesubjects=False):
'dataset': self.dataset_uri(),
'rdffile': self.store.distilled_path(basefile),
'triplestore': self.config.storelocation}):
#with open(self.store.distilled_path(basefile), "rb") as fp:
# data = fp.read()
#ts.add_serialized(data, format="xml", context=self.dataset_uri())
ts.add_serialized_file(self.store.distilled_path(basefile), format="xml",
context=self.dataset_uri())
with open(self.store.distilled_path(basefile), "rb") as fp:
data = fp.read()
ts.add_serialized(data, format="xml", context=self.dataset_uri())
#ts.add_serialized_file(self.store.distilled_path(basefile), format="xml",
# context=self.dataset_uri())

def _get_fulltext_indexer(self, repos, batchoptimize=False):
if not hasattr(self, '_fulltextindexer'):
Expand Down
6 changes: 5 additions & 1 deletion ferenda/documentstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
from urllib.parse import quote, unquote
from gzip import GzipFile
from bz2 import BZ2File
from lzma import LZMAFile
try:
from lzma import LZMAFile
except ImportError:
LZMAFile = None


from ferenda import util
from ferenda import errors
Expand Down
1 change: 0 additions & 1 deletion requirements.py3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ layeredconfig
grako
responses
langdetect
flufl.lock
3 changes: 2 additions & 1 deletion test/testDocRepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,8 @@ def test_relate_all_teardown(self, mock_store):
'force': False,
'storetype': 'a',
'storelocation': 'b',
'storerepository': 'c'}))
'storerepository': 'c',
'bulktripleload': False}))
self.assertTrue(self.repoclass.relate_all_teardown(config))
self.assertTrue(mock_store.connect.called)
self.assertTrue(mock_store.connect.return_value.get_serialized_file.called)
Expand Down
8 changes: 4 additions & 4 deletions test/testDocStore.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def test_open_intermediate_path(self):
filename = self.p("intermediate/123/a.xhtml" + self.expected_suffix)
self.assertTrue(os.path.exists(filename))
mimetype = util.runcmd("file -b --mime-type %s" % filename)[1]
self.assertEqual(self.expected_mimetype, mimetype.strip())
self.assertIn(mimetype.strip(), self.expected_mimetype)
with self.store.open_intermediate("123/a") as fp:
# note, open_intermediate should open the file with the
# the .xhtml suffix automatically
Expand All @@ -362,17 +362,17 @@ def test_open_intermediate_path(self):
class GzipCompression(Compression):
compression = "gz"
expected_suffix = ".gz"
expected_mimetype = "application/x-gzip"
expected_mimetype = ("application/x-gzip", "application/gzip")

class Bzip2Compression(Compression):
compression = "bz2"
expected_suffix = ".bz2"
expected_mimetype = "application/x-bzip2"
expected_mimetype = ("application/x-bzip2",)

class XzCompression(Compression):
compression = "xz"
expected_suffix = ".xz"
expected_mimetype = "application/x-xz"
expected_mimetype = ("application/x-xz",)


import doctest
Expand Down

0 comments on commit 9848aa6

Please sign in to comment.