Skip to content

Commit

Permalink
Added test to identify duplicate entries in jsonldcontext file (#2378)
Browse files Browse the repository at this point in the history
* Added option to output to stdout

* Added call to check for duplicates in jsonldcontext output

* Tweak

Co-authored-by: Richard Wallis <rjw@dataliberate.com>
  • Loading branch information
2 people authored and danbri committed Jan 2, 2020
1 parent 96a9fc2 commit bb8b2bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripts/buildarchivecontext.py
Expand Up @@ -53,9 +53,14 @@


ret = GetJsonLdContext(layers=ALL_LAYERS)
fname = "%s/%s" % (args.outputDirectory,args.output)
print("Writing context to: %s" % fname)
file = open(fname, "w")
f = args.output
if f == "-":
file = sys.stdout
else:
fname = "%s/%s" % (args.outputDirectory,f)
print("Writing context to: %s" % fname)
file = open(fname, "w")
file.write(ret)
file.close()
if file is not sys.stdout:
file.close()

10 changes: 10 additions & 0 deletions scripts/run_tests.py
Expand Up @@ -91,7 +91,17 @@ def main(test_path, args):
# Discover and run tests.
#suite = unittest.loader.TestLoader().discover(test_path)
#unittest.TextTestRunner(verbosity=2).run(suite)

import subprocess
contextCheck = "./scripts/buildarchivecontext.py -o -|cut -d'\"' -f2|sort|uniq -d"

print "Checking jsonldcontext for duplicates"
dups = subprocess.check_output(contextCheck,shell=True)
if len(dups):
print "Duplicate entries in jsonldcontext: %s" % dups
sys.exit(1)
print "No duplicates in jsonldcontext\n\n"

if vars(args)["skipbasics"]:
suite = unittest.loader.TestLoader().discover(test_path, pattern="*graphs*.py")
else:
Expand Down

0 comments on commit bb8b2bc

Please sign in to comment.