@pytest.mark.skipif((not os.getenv('TEST_READ_HUGE_FILE')), reason='Environment variable TEST_READ_HUGE_FILE must be defined to run this test')
def test_read_big_table(tmpdir):
 NB_ROWS = 250000
 NB_COLS = 500
 filename = str(tmpdir.join('big_table.csv'))
 print 'Creating a {} rows table ({} columns).'.format(NB_ROWS, NB_COLS)
 data = np.random.random(NB_ROWS)
 t = Table(data=([data] * NB_COLS), names=[str(i) for i in range(NB_COLS)])
 data = None
 print 'Saving the table to {}'.format(filename)
 t.write(filename, format='ascii.csv', overwrite=True)
 t = None
 print 'Counting the number of lines in the csv, it should be {} + 1 (header).'.format(NB_ROWS)
 assert (sum((1 for line in open(filename))) == (NB_ROWS + 1))
 print 'Reading the file with astropy.'
 t = Table.read(filename, format='ascii.csv', fast_reader=True)
 assert (len(t) == NB_ROWS)

@ pytest . mark . skipif ( ( not os . getenv ( 'TEST_READ_HUGE_FILE' ) ) , reason = 'Environment variable TEST_READ_HUGE_FILE must be defined to run this test' ) def test_read_big_table ( tmpdir ) : NB_ROWS = 250000 NB_COLS = 500 filename = str ( tmpdir . join ( 'big_table.csv' ) ) print 'Creating a {} rows table ({} columns).' . format ( NB_ROWS , NB_COLS ) data = np . random . random ( NB_ROWS ) t = Table ( data = ( [ data ] * NB_COLS ) , names = [ str ( i ) for i in range ( NB_COLS ) ] ) data = None print 'Saving the table to {}' . format ( filename ) t . write ( filename , format = 'ascii.csv' , overwrite = True ) t = None print 'Counting the number of lines in the csv, it should be {} + 1 (header).' . format ( NB_ROWS ) assert ( sum ( ( 1 for line in open ( filename ) ) ) == ( NB_ROWS + 1 ) ) print 'Reading the file with astropy.' t = Table . read ( filename , format = 'ascii.csv' , fast_reader = True ) assert ( len ( t ) == NB_ROWS )
test reading of a huge file .