Merge pull request #12 from sciunto/lib
Store libs in a specific directory
This commit is contained in:
commit
ae66f3b04c
10
bmc.py
10
bmc.py
@ -7,13 +7,13 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import backend
|
|
||||||
import fetcher
|
|
||||||
import tearpages
|
|
||||||
import tools
|
|
||||||
from bibtexparser.bparser import BibTexParser
|
from bibtexparser.bparser import BibTexParser
|
||||||
from codecs import open
|
from codecs import open
|
||||||
from config import Config
|
from libbmc.config import Config
|
||||||
|
from libbmc import backend
|
||||||
|
from libbmc import fetcher
|
||||||
|
from libbmc import tearpages
|
||||||
|
from libbmc import tools
|
||||||
|
|
||||||
|
|
||||||
config = Config()
|
config = Config()
|
||||||
|
4
libbmc/__init__.py
Normal file
4
libbmc/__init__.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env python2
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
|||||||
# Phyks
|
# Phyks
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
import unittest
|
import unittest
|
||||||
from backend import *
|
from libbmc.backend import *
|
||||||
from bibtexparser.bparser import BibTexParser
|
from bibtexparser.bparser import BibTexParser
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
@ -9,11 +9,11 @@
|
|||||||
# Phyks
|
# Phyks
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
import unittest
|
import unittest
|
||||||
from config import Config
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
|
from libbmc.config import Config
|
||||||
|
|
||||||
|
|
||||||
class TestConfig(unittest.TestCase):
|
class TestConfig(unittest.TestCase):
|
@ -10,16 +10,16 @@
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from fetcher import *
|
from libbmc.fetcher import *
|
||||||
|
|
||||||
|
|
||||||
class TestFetcher(unittest.TestCase):
|
class TestFetcher(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
with open("tests/src/doi.bib", 'r') as fh:
|
with open("libbmc/tests/src/doi.bib", 'r') as fh:
|
||||||
self.doi_bib = fh.read()
|
self.doi_bib = fh.read()
|
||||||
with open("tests/src/arxiv.bib", 'r') as fh:
|
with open("libbmc/tests/src/arxiv.bib", 'r') as fh:
|
||||||
self.arxiv_bib = fh.read()
|
self.arxiv_bib = fh.read()
|
||||||
with open("tests/src/isbn.bib", 'r') as fh:
|
with open("libbmc/tests/src/isbn.bib", 'r') as fh:
|
||||||
self.isbn_bib = fh.read()
|
self.isbn_bib = fh.read()
|
||||||
|
|
||||||
def test_download(self):
|
def test_download(self):
|
||||||
@ -35,13 +35,13 @@ class TestFetcher(unittest.TestCase):
|
|||||||
|
|
||||||
def test_findISBN_DJVU(self):
|
def test_findISBN_DJVU(self):
|
||||||
# ISBN is incomplete in this test because my djvu file is bad
|
# ISBN is incomplete in this test because my djvu file is bad
|
||||||
self.assertEqual(findISBN("tests/src/test_book.djvu"), '978295391873')
|
self.assertEqual(findISBN("libbmc/tests/src/test_book.djvu"), '978295391873')
|
||||||
|
|
||||||
def test_findISBN_PDF(self):
|
def test_findISBN_PDF(self):
|
||||||
self.assertEqual(findISBN("tests/src/test_book.pdf"), '9782953918731')
|
self.assertEqual(findISBN("libbmc/tests/src/test_book.pdf"), '9782953918731')
|
||||||
|
|
||||||
def test_findISBN_False(self):
|
def test_findISBN_False(self):
|
||||||
self.assertFalse(findISBN("tests/src/test.pdf"))
|
self.assertFalse(findISBN("libbmc/tests/src/test.pdf"))
|
||||||
|
|
||||||
def test_isbn2Bib(self):
|
def test_isbn2Bib(self):
|
||||||
self.assertEqual(isbn2Bib('0198507194'), self.isbn_bib)
|
self.assertEqual(isbn2Bib('0198507194'), self.isbn_bib)
|
||||||
@ -50,16 +50,16 @@ class TestFetcher(unittest.TestCase):
|
|||||||
self.assertEqual(isbn2Bib('foo'), '')
|
self.assertEqual(isbn2Bib('foo'), '')
|
||||||
|
|
||||||
def test_findDOI_PDF(self):
|
def test_findDOI_PDF(self):
|
||||||
self.assertEqual(findDOI("tests/src/test.pdf"),
|
self.assertEqual(findDOI("libbmc/tests/src/test.pdf"),
|
||||||
"10.1103/physrevlett.112.253201")
|
"10.1103/physrevlett.112.253201")
|
||||||
|
|
||||||
def test_findDOI_DJVU(self):
|
def test_findDOI_DJVU(self):
|
||||||
# DOI is incomplete in this test because my djvu file is bad
|
# DOI is incomplete in this test because my djvu file is bad
|
||||||
self.assertEqual(findDOI("tests/src/test.djvu"),
|
self.assertEqual(findDOI("libbmc/tests/src/test.djvu"),
|
||||||
"10.1103/physrevlett.112")
|
"10.1103/physrevlett.112")
|
||||||
|
|
||||||
def test_findDOI_False(self):
|
def test_findDOI_False(self):
|
||||||
self.assertFalse(findDOI("tests/src/test_arxiv_multi.pdf"))
|
self.assertFalse(findDOI("libbmc/tests/src/test_arxiv_multi.pdf"))
|
||||||
|
|
||||||
def test_doi2Bib(self):
|
def test_doi2Bib(self):
|
||||||
self.assertEqual(doi2Bib('10.1103/physreva.88.043630'), self.doi_bib)
|
self.assertEqual(doi2Bib('10.1103/physreva.88.043630'), self.doi_bib)
|
||||||
@ -68,7 +68,7 @@ class TestFetcher(unittest.TestCase):
|
|||||||
self.assertEqual(doi2Bib('blabla'), '')
|
self.assertEqual(doi2Bib('blabla'), '')
|
||||||
|
|
||||||
def test_findArXivId(self):
|
def test_findArXivId(self):
|
||||||
self.assertEqual(findArXivId("tests/src/test_arxiv_multi.pdf"),
|
self.assertEqual(findArXivId("libbmc/tests/src/test_arxiv_multi.pdf"),
|
||||||
'1303.3130v1')
|
'1303.3130v1')
|
||||||
|
|
||||||
def test_arXiv2Bib(self):
|
def test_arXiv2Bib(self):
|
||||||
@ -78,7 +78,7 @@ class TestFetcher(unittest.TestCase):
|
|||||||
self.assertEqual(arXiv2Bib('blabla'), '')
|
self.assertEqual(arXiv2Bib('blabla'), '')
|
||||||
|
|
||||||
def test_findHALId(self):
|
def test_findHALId(self):
|
||||||
self.assertTupleEqual(findHALId("tests/src/test_hal.pdf"),
|
self.assertTupleEqual(findHALId("libbmc/tests/src/test_hal.pdf"),
|
||||||
('hal-00750893', '3'))
|
('hal-00750893', '3'))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
@ -10,7 +10,7 @@
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from tools import *
|
from libbmc.tools import *
|
||||||
|
|
||||||
|
|
||||||
class TestTools(unittest.TestCase):
|
class TestTools(unittest.TestCase):
|
Loading…
Reference in New Issue
Block a user