[pybliographer/wip/gtk3] format: set paths according to location of files
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pybliographer/wip/gtk3] format: set paths according to location of files
- Date: Wed, 11 Oct 2017 20:13:41 +0000 (UTC)
commit ffaf7d17876cf297a543be9f526dc2d37bc88070
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Wed Oct 11 15:50:23 2017 -0300
format: set paths according to location of files
Make the test working from any directory, e.g. when running
nosetests.
Pyblio/Format/test_Isi.py | 33 +++++++++++++++------------------
Pyblio/Format/test_Ovidlike.py | 18 ++++--------------
2 files changed, 19 insertions(+), 32 deletions(-)
---
diff --git a/Pyblio/Format/test_Isi.py b/Pyblio/Format/test_Isi.py
index e73ab38..26fbff7 100644
--- a/Pyblio/Format/test_Isi.py
+++ b/Pyblio/Format/test_Isi.py
@@ -2,12 +2,15 @@
import cStringIO, os, sys, unittest
-sys.path.append (os.path.abspath('../..'))
-print os.path.abspath('../..')
+basedir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+sys.path.append(basedir)
-from Pyblio.Format import isifile
from Pyblio import Base, Config, Fields
+Config.parse_directory(os.path.join(basedir, 'ConfDir'))
+Config.load_user()
+
+from Pyblio.Format import isifile
example_1 = """AU Bogin, B
TI Evolutionary hypotheses for human childhood
@@ -41,20 +44,18 @@ ER
"""
class ReaderCase (unittest.TestCase):
-
- def setUp (self):
-
- Config.parse_directory (os.path.abspath('../ConfDir'))
- Config.load_user ()
- print 'CONFIGURATION'
- print 50*'-'
- for i in Config.domains ():
- print i, Config.keys_in_domain (i)
- print 'END', 50*'-'
+ def setUp(self):
+ print 'CONFIGURATION'
+ print 50*'-'
+ for i in Config.domains ():
+ print i, Config.keys_in_domain (i)
+ print 'END', 50*'-'
self.db = Base.DataBase ('//localhost/Internal')
self.output = cStringIO.StringIO()
-
+ def teardown(self):
+ Config.forget_changes()
+
def test01(self):
"""Test that all fields are Instances, as
opposed to strings"""
@@ -171,10 +172,6 @@ if __name__ == '__main__':
### End:
-
-
-
-
diff --git a/Pyblio/Format/test_Ovidlike.py b/Pyblio/Format/test_Ovidlike.py
index 9ea27db..512b541 100644
--- a/Pyblio/Format/test_Ovidlike.py
+++ b/Pyblio/Format/test_Ovidlike.py
@@ -115,7 +115,8 @@ Abstract
import cStringIO, os, os.path, re, sys,unittest
-sys.path.append (os.path.abspath('../..'))
+basedir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+sys.path.append(basedir)
from Pyblio.Base import DataBase, Entry
from Pyblio import Config
@@ -125,17 +126,13 @@ from Pyblio.Format.OvidLike import OvidLike, writer, write_source_field
from Pyblio.Fields import Date
class WriterCase (unittest.TestCase):
-
def setUp (self):
-
-
- Config.parse_directory (os.path.abspath('../ConfDir'))
- Config.load_user ()
+ Config.parse_directory(os.path.join(basedir, 'ConfDir'))
+ Config.load_user()
self.db = DataBase ('//localhost/Internal')
self.output = cStringIO.StringIO()
self.mapping = Config.get('ovid/mapping').data
-
def test01(self):
self.entry = Entry ( Key('TEST', 'KEY1'), get_entry('article'),
@@ -149,9 +146,7 @@ class WriterCase (unittest.TestCase):
writer (self.itera, self.output, self.mapping)
print self.output.getvalue()
-
def test02source (self):
-
data = [ ## from cites.ovid
{'result':
'International Journal of Hematology. 69(2):81-88, 1999 Feb.',
@@ -384,8 +379,3 @@ if __name__ == '__main__':
### Mode: python
### encoding: utf-8
### End:
-
-
-
-
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]