Skip to content
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

TST: Refactoring backend tests #2566

Merged
merged 6 commits into from
Dec 11, 2020
Merged

TST: Refactoring backend tests #2566

merged 6 commits into from
Dec 11, 2020

Conversation

datapythonista
Copy link
Contributor

Better structure of the backend tests. The diff is big, but there are just two changes:

  • Moving the backend tests from ibis/tests/all to ibis/backends/tests
  • Moving the test classes of the backends from ibis/tests/backends.py to ibis/backends/<backend>/tests/conftest.py

The idea is to make the backend tests not know about the specific backends, and have a better decouping of things, so backends that are in a separate repo can also be tested.

@datapythonista datapythonista added refactor Issues or PRs related to refactoring the codebase tests Issues or PRs related to tests backends Issues related to all backends labels Dec 9, 2020
@datapythonista
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@datapythonista
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jreback jreback added this to the Next release milestone Dec 11, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. just a couple of questions.

@@ -7,7 +7,7 @@
import ibis.common.exceptions as com
import ibis.expr.datatypes as dt
import ibis.expr.types as ir
from ibis.tests.backends import Spark
from ibis.backends.spark.tests.conftest import SparkTest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm isn't this a pytest warning? we generally don't want to do this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. just put the methods in another file (not conftest)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok changing this, but pytest is happy, no warnings. And in several cases there is already related code in conftest.py. For example, in bigquery the connect methods of the tests class is already in conftest. And in omnisci and others, the parameters for the connection are loaded in conftest and reused for both the test class and for things in conftest. That's why I thought that conftest is a better place (even if in couple of instances like this one conftest needs to be imported). And also because the class is not tests themselves but more the configuration (even if not pytest specific).

So, to me it makes a bit more sense to leave the test classes in conftest.py, but if you have a strong opinion on having it separate, I'm ok with that, I'll move it next week. Let me know if you have a preference for the file where to save it (since I need to create 12 of them, to not waste time with renames later).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope it's fine

in pandas we prohibit this but maybe that's some enforced outside of pytest i don't remember

)
)

for marker in list(item.iter_markers(name="xpass_backends")):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure. I opened #2570, and will have a look next week. I don't want to remove of change any code in this PR, and just have the code copied as is, so we can track the changes easier later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok cool

@jreback jreback merged commit 1498414 into ibis-project:master Dec 11, 2020
@jreback
Copy link
Contributor

jreback commented Dec 11, 2020

thanks @datapythonista very nice

makes testing more obvious - happy to have it

at some point would be great to describe this testing paradigm in a readme / docs

@datapythonista
Copy link
Contributor Author

at some point would be great to describe this testing paradigm in a readme / docs

Great idea. I created #2571. Will probably wait a bit for it, since I think we can still make things a bit simpler first, but will be adding docs for it.

@jreback
Copy link
Contributor

jreback commented Dec 11, 2020

yes for sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backends Issues related to all backends refactor Issues or PRs related to refactoring the codebase tests Issues or PRs related to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants