Skip to content

CI: create/drop pandas_nosetest db on class instatiation #7091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jreback opened this issue May 10, 2014 · 5 comments
Closed

CI: create/drop pandas_nosetest db on class instatiation #7091

jreback opened this issue May 10, 2014 · 5 comments
Labels
CI Continuous Integration IO SQL to_sql, read_sql, read_sql_query

Comments

@jreback
Copy link
Contributor

jreback commented May 10, 2014

So I think that the SQL test classes should inherit from:

https://github.com/pydata/pandas/blob/master/pandas/util/testing.py#L65

then you can add

class BaseSQLTestCase(tm.TestCase):

   @classmethod
    def setUpClass(cls):
        super(BaseSQLTestCase, cls).setUpClass()

        # create the ``pandas_nosetest`` db here

   @classmethod
    def tearDownClass(cls):
        super(BaseSQLTestCase, cls).tearDownClass()

        # drop the ``pandas_nosetest`` db here

and remove this:
https://github.com/pydata/pandas/blob/master/.travis.yml#L100

This doesn't affect travis, but testing on a static platform (e.g. windows)
where the database in theory could have something in it (if a test was stopped in the middle) and then the next time it runs their is stuff there

@jreback jreback added this to the 0.14.0 milestone May 10, 2014
@jreback jreback modified the milestones: 0.14.1, 0.14.0 May 11, 2014
@jorisvandenbossche
Copy link
Member

@jreback If a test fails, then the tearDown function is not called anymore? Because normally this should assure there are no tables in the database for the following test (eg https://github.com/pydata/pandas/blob/master/pandas/io/tests/test_sql.py#L971)

@jreback
Copy link
Contributor Author

jreback commented May 13, 2014

no it is
but if the script is interrupted in the middle of test (and for some reason these take a while on windows) then it could be in an uknown state

more important I think is that no sql tests can be run by users because they almost certainly don't have the correct database created

not sure if that is an issue

@jorisvandenbossche
Copy link
Member

The reason I would rather not do this, is that the tests aren't already that fast, and this will likely slow it down?
We could also check for existing tables in the setUp after connecting (for case of interruption)?

About having the correct database created for users who run the tests, that is indeed a problem. But I think you will have to configure your setup in any case a bit manually. As it is also not that likely that you have the exact same username/password as what is used in the tests. In that case it is not much work to once create the database I think.

@jorisvandenbossche
Copy link
Member

Ah, but you meant a setupClass, so not for every test. So my speed argument is not valid.

@jreback
Copy link
Contributor Author

jreback commented May 13, 2014

yeh....once for each class (its not really a big deal). though maybe include some method of haveing a user configure the db's and such so they can actually run the tests locally (not sure how to do this) e.g. a method of specifying to nose your db configuration (maybe sqlalchemy has something for this)?

@jreback jreback modified the milestones: 0.15.0, 0.14.1 Jun 17, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@jschendel jschendel modified the milestones: Contributions Welcome, No action Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration IO SQL to_sql, read_sql, read_sql_query
Projects
None yet
Development

No branches or pull requests

3 participants