Allow tests to be run from any directory.

This commit is contained in:
Marcel Rodrigues
2013-10-03 12:50:34 -03:00
parent be48bb6785
commit 1f4771dfef

View File

@@ -9,7 +9,7 @@ except ImportError:
class PyMySQLTestCase(unittest.TestCase):
# You can specify your test environment creating a file named
# "databases.json" or editing the `databases` variable below.
fname = "pymysql/tests/databases.json"
fname = os.path.join(os.path.dirname(__file__), "databases.json")
if os.path.exists(fname):
with open(fname) as f:
databases = json.load(f)