コード例 #1
0
ファイル: test_display.py プロジェクト: ThomasRoca/diogenes
 def tearDownClass(cls):
     report_path = cls.report.to_pdf(verbose=False)
     uft.print_in_box(
         'Test display visual regression tests',
         ['graphical output available at:',
          report_path,
          'Reference available at:',
          REFERENCE_REPORT_PATH])
コード例 #2
0
 def test_open_csv_url(self):
     url = 'http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv'
     try:
         urllib2.urlopen(url)
     except (urllib2.HTTPError, urllib2.URLError):
         utils_for_tests.print_in_box('skipping test_open_csv_url',
                                      'remote resource not found')
         self.skipTest('couldn\'t get remote resource')
     sa = read.open_csv_url(url, delimiter=';')
     ctrl_dtype = [('fixed acidity', '<f8'), ('volatile acidity', '<f8'),
                   ('citric acid', '<f8'), ('residual sugar', '<f8'),
                   ('chlorides', '<f8'), ('free sulfur dioxide', '<f8'),
                   ('total sulfur dioxide', '<f8'), ('density', '<f8'),
                   ('pH', '<f8'), ('sulphates', '<f8'), ('alcohol', '<f8'),
                   ('quality', '<i8')]
     self.assertEqual(sa.dtype, ctrl_dtype)
コード例 #3
0
ファイル: test_pgres.py プロジェクト: digideskio/diogenes
 def setUpClass(cls):
     cls.skip = False
     try:
         pgres_host = os.environ['DIOGENES_PGRES_TEST_HOST']
         pgres_db = os.environ['DIOGENES_PGRES_TEST_DB']
         pgres_user = os.environ['DIOGENES_PGRES_TEST_USER']
         pgres_pw = os.environ['DIOGENES_PGRES_TEST_PW']
     except KeyError:
         uft.print_in_box(
             'Skipping TestPgres',
             ('TestPgres requires the following environmental variables '
              'to be defined:\n'
              '* DIOGENES_PGRES_TEST_HOST\n'
              '* DIOGENES_PGRES_TEST_DB\n'
              '* DIOGENES_PGRES_TEST_USER\n'
              '* DIOGENES_PGRES_TEST_PW\n'
              '* DIOGENES_PGRES_TEST_PORT (optional)\n'
              'At least one of these is not defined. Skipping TestPgres'))
         cls.skip = True
         return
     try:
         pgres_port = os.environ['DIOGENES_PGRES_TEST_PORT']
     except KeyError:
         pgres_port = '5432'
     os.environ['PGPASSWORD'] = pgres_pw
     if subprocess.call(['psql', '-h', pgres_host, '-d', pgres_db, '-U',
                         pgres_user, '-p', pgres_port, '-f', 
                         uft.path_of_data('populate_pgres.sql')]):
         uft.print_in_box(
             'Skipping TestPgres',
             ('Could not populate database.\n'
              'Perhaps Postgres server is not running or the following\n'
              'environmental variables are defined incorrectly:\n'
              '* DIOGENES_PGRES_TEST_HOST\n'
              '* DIOGENES_PGRES_TEST_DB\n'
              '* DIOGENES_PGRES_TEST_USER\n'
              '* DIOGENES_PGRES_TEST_PW\n'
              '* DIOGENES_PGRES_TEST_PORT (optional)\n'
              'Skipping TestPgres'))
         cls.skip = True
         return
     cls.conn_str = 'postgresql://{}:{}@{}:{}/{}'.format(
             pgres_user,
             pgres_pw,
             pgres_host,
             pgres_port,
             pgres_db)
コード例 #4
0
 def setUpClass(cls):
     cls.skip = False
     try:
         pgres_host = os.environ['DIOGENES_PGRES_TEST_HOST']
         pgres_db = os.environ['DIOGENES_PGRES_TEST_DB']
         pgres_user = os.environ['DIOGENES_PGRES_TEST_USER']
         pgres_pw = os.environ['DIOGENES_PGRES_TEST_PW']
     except KeyError:
         uft.print_in_box(
             'Skipping TestPgres',
             ('TestPgres requires the following environmental variables '
              'to be defined:\n'
              '* DIOGENES_PGRES_TEST_HOST\n'
              '* DIOGENES_PGRES_TEST_DB\n'
              '* DIOGENES_PGRES_TEST_USER\n'
              '* DIOGENES_PGRES_TEST_PW\n'
              '* DIOGENES_PGRES_TEST_PORT (optional)\n'
              'At least one of these is not defined. Skipping TestPgres'))
         cls.skip = True
         return
     try:
         pgres_port = os.environ['DIOGENES_PGRES_TEST_PORT']
     except KeyError:
         pgres_port = '5432'
     os.environ['PGPASSWORD'] = pgres_pw
     if subprocess.call([
             'psql', '-h', pgres_host, '-d', pgres_db, '-U', pgres_user,
             '-p', pgres_port, '-f',
             uft.path_of_data('populate_pgres.sql')
     ]):
         uft.print_in_box(
             'Skipping TestPgres',
             ('Could not populate database.\n'
              'Perhaps Postgres server is not running or the following\n'
              'environmental variables are defined incorrectly:\n'
              '* DIOGENES_PGRES_TEST_HOST\n'
              '* DIOGENES_PGRES_TEST_DB\n'
              '* DIOGENES_PGRES_TEST_USER\n'
              '* DIOGENES_PGRES_TEST_PW\n'
              '* DIOGENES_PGRES_TEST_PORT (optional)\n'
              'Skipping TestPgres'))
         cls.skip = True
         return
     cls.conn_str = 'postgresql://{}:{}@{}:{}/{}'.format(
         pgres_user, pgres_pw, pgres_host, pgres_port, pgres_db)
コード例 #5
0
ファイル: test_read.py プロジェクト: digideskio/diogenes
 def test_open_csv_url(self): 
     url = 'http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv'
     try:
         urllib2.urlopen(url)
     except (urllib2.HTTPError, urllib2.URLError):
         utils_for_tests.print_in_box('skipping test_open_csv_url', 'remote resource not found')
         self.skipTest('couldn\'t get remote resource')
     sa = read.open_csv_url(url, delimiter=';')
     ctrl_dtype = [('fixed acidity', '<f8'), 
                   ('volatile acidity', '<f8'), 
                   ('citric acid', '<f8'), 
                   ('residual sugar', '<f8'), 
                   ('chlorides', '<f8'), 
                   ('free sulfur dioxide', '<f8'), 
                   ('total sulfur dioxide', '<f8'), 
                   ('density', '<f8'), 
                   ('pH', '<f8'), 
                   ('sulphates', '<f8'), 
                   ('alcohol', '<f8'), 
                   ('quality', '<i8')]
     self.assertEqual(sa.dtype, ctrl_dtype)
コード例 #6
0
 def tearDownClass(cls):
     report_path = cls.report.to_pdf(verbose=False)
     uft.print_in_box('Test Perambulate visual regression tests', [
         'graphical output available at:', report_path,
         'Reference available at:', REFERENCE_REPORT_PATH
     ])