vibration_toolbox
vibration_toolbox copied to clipboard
Implementing unit tests
List of test files to be added (one for each module):
- [ ] test_sdof.py
- [x] test_mdof.py
- [ ] test_sdof.py
- [ ] test_continuous_systems.py
- [ ] test_ema.py
- [x] test_vibesystem.py
@josephcslater I saw your commits and comments regarding implementing unit tests instead of having only doctests. I totally agree that we should do that. I think it would be a good idea to split the tests between files that will test each module (test_sdof.py, test_mdof.py...) to avoid having lots of tests in only one file.
I was taking a look at the travis build history. I saw the following error when you tried to add the test file:
______ ERROR collecting vibration_toolbox/tests/test_vibration_toolbox.py ______
ImportError while importing test module '/home/travis/build/vibrationtoolbox/vibration_toolbox/vibration_toolbox/tests/test_vibration_toolbox.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
vibration_toolbox/tests/test_vibration_toolbox.py:3: in <module>
import vibrationtesting as vt
E ModuleNotFoundError: No module named 'vibrationtesting'
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 2 error in 1.81 seconds ============================
Was this vibrationtesting module added to the commit? I could not find it. The tests were failing on your local machine?
I just copied the file from my vobrationtesting module. (pip install )
You can find it if interested. It’s more professional grade.
I will take a look at the module! I think the file didn't make to the commit. Maybe it was not included in your version control and not pushed to git I imagine...
It certainly didn't. I was very lazy and just tried to move the text file over to use as a quick reference. Sloppy.
The vibrationtesting module is a companion to my text (that is in progress). It's also intended to be more useful as a tool instead of as a learning aid.
Some actions in the vibration toolbox are repeated, but I simplified and used better calls. For instance: M, C, and K are symmetric so often that I use symmetric eigensolvers that will be much more reliable. If C or K is not, state space can always be used. However, this is not an emphasis of my manuscript.
Some of the code (the modal parameter ID) actually came to the vibration toolbox from my Matlab version of the vibration testing toolbox (which is stagnated at this time). I'll have more "professional grade" ID algorithms eventually. I've coded them before, but was sloppy and lost them.
You're welcome, of course, to contribute to the other code base as well. Happy to share the manuscript with you if you are interested, noting that it is a work in progress.
I will add a list test files that we should have and start to add them.
Yes I would like to see your manuscript!
test_mdof started.