Skip to content

Conversation

parejkoj
Copy link
Contributor

@parejkoj parejkoj commented Mar 9, 2022

This ended up being rather trivial; I'm putting this in review while I keep working on the flask/google.cloud tests (trying to mock a non-installed package (gcloud) is tricky). I'd rather have something to run in a github action now, while we figure out what we want the tests to actually do (I can't mock the butler interface until I have a better sense of how we'll actually use it).

@parejkoj parejkoj requested a review from kfindeisen March 9, 2022 01:36
Copy link
Member

@kfindeisen kfindeisen 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; some style comments.

@@ -1,3 +1,5 @@
__all__ = ["Visit"]
Copy link
Member

Choose a reason for hiding this comment

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

No license statement?

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 didn't want to muck with the visit.py files, because we may want to consolidate those somehow (there's two copies in different places).

Copy link
Member

Choose a reason for hiding this comment

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

This is the real one, the other is a symlink. I'm pretty sure we can delete the latter if we change the import in upload.py, I guess I was waiting for test coverage of upload before trying. 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point, but I'm nervous about writing tests of upload (see KT's comment on DM-33938: upload.py is a test itself)

Copy link
Member

@kfindeisen kfindeisen Mar 9, 2022

Choose a reason for hiding this comment

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

I disagree -- for now, at least, upload.py is the server for which activator.py is the client; that makes it part of the system we're developing. In particular, we probably will need to make changes to upload.py as we start doing more substantial integration testing. (And some of those changes, especially anything involving the next_visit message, might well be reflected in the production system.)

"""Interface layer between the Butler middleware and the prompt processing
data handling system.
Parameters
Copy link
Member

Choose a reason for hiding this comment

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

Can you include an explanation of what a MiddlewareInterface object actually represents? I find it very confusing that __init__ performs Butler operations, some of them ones that change state.

The fact that some (but not all) of the code assumes multiple concurrent MiddlewareInterface objects is probably a clue...

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've added a paragraph, but I think we don't want to assume that any of the stuff in __init__ will stick around (I suspect most of that should move to prep_butler, but don't know yet).

Copy link
Member

Choose a reason for hiding this comment

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

Of course, and we shouldn't document implementations anyway. I just meant that the class seems to be intended to be used in particular ways, which are not at all obvious from the name.

@parejkoj
Copy link
Contributor Author

parejkoj commented Mar 9, 2022

Please have another look at the middleware docstrings: I've tweaked them per your suggestions.

Copy link
Member

@kfindeisen kfindeisen 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! Thanks for being patient with my pickiness. 🙂

parejkoj added 5 commits March 9, 2022 13:53
Use relative imports so tests are happy.
We can use pytest-only features, so we don't need the unittest.main stuff.
I tried to remove unittest entirely (no parent class), but assertLogs is much
easier to use than the pytest equivalent, it appears. We might want the
activator tests to be pure pytest because there are useful Flask fixtures.
@parejkoj parejkoj merged commit 787b7b2 into main Mar 9, 2022
@parejkoj parejkoj deleted the tickets/DM-33935 branch March 9, 2022 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants