Exemple #1
0
    def test_get_files(self):
        expected = [find_first_fixture("ace.n3", APP_LABEL)]
        self.assertEquals(expected, get_rdf_files(expected))

        expected = [find_first_fixture("melissa.rdf", APP_LABEL)]
        self.assertEquals(expected, get_rdf_files(expected))

        fixtures_dir = os.path.dirname(expected[0])
        all_files = get_rdf_files([fixtures_dir])
        self.assertTrue(find_first_fixture("ace.n3", APP_LABEL) in all_files)
        self.assertTrue(find_first_fixture("melissa.rdf", APP_LABEL) in all_files)
 def handle(self, *args, **options):
     try:
         files = get_rdf_files(args, recursive=options["recursive"])
         if not files:
             raise CommandError("You must specify at least one valid RDF file.")
         fourstore_setup(settings.FOURSTORE_KBNAME)
         fourstore_backend(settings.FOURSTORE_KBNAME)
         fourstore_import(settings.FOURSTORE_KBNAME, files)
     except AttributeError:
         raise CommandError("You must set FOURSTORE_KBNAME and FOURSTORE_PORT in your settings.py.")
     except OSError:
         raise CommandError("Please ensure 4store is installed and accessible in $PATH.")
     finally:
         fourstore_kill(settings.FOURSTORE_KBNAME, settings.FOURSTORE_PORT)
Exemple #3
0
 def test_get_files_recusrive(self):
     app_dir = os.path.dirname(os.path.abspath(__file__))
     all_files = get_rdf_files([app_dir], recursive=True)
     fixtures_dir = os.path.join(app_dir, "fixtures")
     self.assertTrue(os.path.join(fixtures_dir, "ace.n3") in all_files)
     self.assertTrue(os.path.join(fixtures_dir, "melissa.rdf") in all_files)