Skip to content

Tag: unit-testing

How to run Python unit test with maven in Java project?

I have a project that mainly uses Java. We implemented some Python functions in a package and would like to unit test them. There is a package called src/python where these .py files are located. I have to problems implementing the tests: How can I make sure that these unit tests integrate with the maven test…

Unittest is throwing an error Empty suite

Python is throwing an error ‘Empty suite’ when I test my code. The strange thing is when I run Then this will work, however when I run the actual test for my code This will throw me like : I guess it’s not an issue with unittest but only my code. Source code itself is working fine when I run

Unable to mock os name with Python on Windows

I have the following method: I’m trying to test it like this: But then the following error is raised: What is happening exactly? Answer What is happening here is that pytest internally uses a pathlib.Path object, which upon initialization asks for os.name to define which Path implementation to use. Ther…

How deal with the UndefinedUnitError?

I downloaded data from noaa and i wanted to calculate vertical velocity using the function vertical_velocity=metpy.calcmpcalc.vertical_velocity(omega,pressure,temperature). But something wrong when i dealing with the units of varibles. **The units of omega, height and temperature are ‘Pascal/s’, &…