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

V03 issue721 - fix so filetype detection is now an optional extra #734

Closed
wants to merge 11 commits into from

Conversation

petersilva
Copy link
Contributor

As explored in #721: There is a new feature in 3.0.42, where the content-type header of each file is included in the message... so people can know the filetype before downloading. It is a mandatory field in the WMO messages, so needed the functionality to be able to export cleanly, and itś a good thing anyways, so added it to base message format.

That required an additional dependency ¨python-magic" It turns out this dependency is troublesome. The debian packaged python packege is python3-magic, the pip install package name is python-magic but that only works on linux. on windows you need to install python-magic-bin. On linux, the debian package has a dependency on libmagic1, but if you install with pip, it won´t pull in the dep... and containers seem to be missing it. So in some cases you need to install libmagic1 by hand separately. A bit of a mess.

Already have a mechanism for dealing with troublesome or fairly optional dependencies, in python they are called extras. but that only covers installation. There is also code built into sr3 to survey for the check for presence of extra library and only try to use it if it is present. so ´filetype' is now an extra feature. In this case, it just degrades to omitting the header in the messages it posts.

There is also some missing documentation in the install process, because the amqp library is now an optional extra, and nobody changed the docs... to install you need to install a message passing library as well as the package now, So added that to the documentation.

(some people want to be able to do minimal installs with mqtt, and resented having to have amqp on the machine.)

petersilva and others added 11 commits June 27, 2023 14:27
…For #709 (#710)

When a file was downloaded successfully, but the size was different than in the message, or the message didn't include a file size, still rename the file and patch content_type.
Thanks very much!
…_WIP

"possibly undeclared" option message should only be printed once.
These were found when developing unit tests
* New sarracenia init tests

* Add pytest-mock requirement for unit tests

* Sarracenia init unit test

This has about 90% coverage

* Update tests README with extra info on config

Debugging tests wasn't working, and it's because generating code coverage while debugging breaks debugging.

* Add try/except around init tests that use xattr module

Apparently it's not a standard module everywhere, so this is a workaround
Could also juse use SR3's filemetadata methods, as they handle things "nicely"
* Expand test debugging (pretty)

Pretty printing wasn't awesome, but now it's better.

* Move Options into a proper class

* Move message creation into method

This ensures that there's no collisions between tests if we modify properties/dict values

* Use deepcopy on WorkList creation in each test

This ensures that they're always unique, and have no collisions between tests

* Fix broken retry tests

* Add Note to top of retry "steps" test

It's disabled, but can serve as good documentation of how to do it.

* Capture test log existance, and assert against that

It used to assert inside the "if" statement, but that would only ever be True. This way, it would be possible for the logs to be missing, and the test will fail.

* Fix redisqueue cleanup test

No longer need to specify a fake server, becasue we're checking the keys a little more inteligently.

* Clean up commented code

* Expand test debugging (pretty)

Pretty printing wasn't awesome, but now it's better.

* Move Options into a proper class

* Move message creation into method

This ensures that there's no collisions between tests if we modify properties/dict values

* Use deepcopy on WorkList creation in each test

This ensures that they're always unique, and have no collisions between tests

* Fix broken retry tests

* Add Note to top of retry "steps" test

It's disabled, but can serve as good documentation of how to do it.

* Capture test log existance, and assert against that

It used to assert inside the "if" statement, but that would only ever be True. This way, it would be possible for the logs to be missing, and the test will fail.

* Fix redisqueue cleanup test

No longer need to specify a fake server, becasue we're checking the keys a little more inteligently.

* Clean up commented code
Also added *all* extra to install all extras.
documenting recent changes (optional filetypes extra) and recent
both languages.
@petersilva petersilva closed this Jul 27, 2023
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.

5 participants