-
Notifications
You must be signed in to change notification settings - Fork 308
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
Experiment: Configure test suite to use Jupyterhub Pytest Plugin #476
base: main
Are you sure you want to change the base?
Conversation
Ping @GeorgianaElena I am getting the same errors here as well. sqlalchemy.exc.ArgumentError: Column expression, FROM clause, or other columns clause element expected, got [1]. Did you mean to say select(1)? This seems to happen at the point the app is trying to connect to the database. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, looks like the tests error because of jupyterhub/jupyterhub#4312
Due to this, I believe the next steps are to:
-
Open an issue in
dockerspawner
asking for feedback from the community about the best way to fix the sqalchemy issue, with the following context:jupyterhub
backported thesqalchemy
compatibility fix to jupyterhub>=3.0- but it didn't pin
sqalchemy
to < 2.0.0 for jupyterhub<3.0 - in dockerspawner we can go around this by either:
- dropping support for jupyterhub < 3.0
- pin
sqalchemy
to < 2.0.0 for jupyterhub<3.0 in either jupyterhub or dockerspawner
-
2. To not block this work on the first task ⬆️ add a new test strategy to the matrix to test against
jupyterhub
3.1.1 that has fixed thesqlalchemy
compatibility issue.
dockerspawner/.github/workflows/test.yml
Lines 19 to 20 in 8503af6
matrix: include:
and only care about that tests while trying to integrate the plugin into dockerspawner.
I think it's reasonable to only support supported JupyterHub versions, it's always possible for someone to install an older version if they're still running an older JupyterHub version. |
@Sheila-nk, for point 2, I suggest opening a new PR, separate than this one since that is beneficial outside of this context too.
@manics, I agree 👍🏼 I suggested @Sheila-nk to propose this in #477 rather than have that be a bug report |
@GeorgianaElena
With exceptions, I have tried to use the @pytest.fixture
async def hub_app(configured_mockhub_instance):
# Function to create hub instance
async def _create_hub_app(config={}):
app = configured_mockhub_instance(config)
await app.initialize()
await app.start()
return app
# Function to clean up the hub instance and resources
async def _cleanup_hub_instance():
app = MockHub.instance()
app.log.handlers = []
try:
if app.http_server:
app.http_server.stop()
await app.shutdown_cancel_tasks()
except Exception as e:
print("Error stopping Hub: %s" % e, file=sys.stderr)
finally:
MockHub.clear_instance()
try:
yield _create_hub_app
finally:
await _cleanup_hub_instance() Will continue looking into it. |
@Sheila-nk, before analyzing this in more detail, I believe first thing should be to remove all imports from Prior, But this is not the case anymore with pytest plugins, so we can safely get rid of those imports. The "Fixture availabilty` section of the pytest docs provides great info and visual of this fixture execution and load order, or overrinding and even how plugin come into picture https://docs.pytest.org/en/latest/reference/fixtures.html#fixture-availability |
😄 I am so annoyed! I spent hours trying to find a solution to the event loop closing and all I needed to do was remove the fixture imports we don't need anymore. Thank you, @GeorgianaElena. The tests using |
@minrk I think we might need to install |
for more information, see https://pre-commit.ci
This pull request is a demonstration of how the JupyterHub Pytest Plugin specifically the
hub_app
fixture can be used in the DockerSpawner repository.We achieved this through the following steps:
pip
jupyterhub_spawners_plugin
in theconftest.py
filehub_app
fixture in place of the JupyterHubapp
fixture