0

I write a Python module that accesses OS resources and can change their state (e.g. firewall rules).

So when I create a unit test for removing a rule from the firewall, it only works when the specific rule was added before. This violates the the 'isolation' property of unit tests.

Is there another way to test a module like this? Maybe with a Docker container for testing?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Mike
  • 13
  • 4
  • Mike commented an answer of mine like this: "My framework has to run on different platforms (RHEL, Windows). Is there a good approach to test on those plattforms automaticly (maybe building a docker container for testing) without a CI pipeline? " – progmatico Jan 02 '21 at 17:09
  • I deleted my answer because I think it does not address your real problem. Also it looks like there are several different strategies for this, that also depend both on the concrete scenario, and on [debatable](https://stackoverflow.com/questions/31196942/running-tests-as-usual-against-docker-containers-or-dockerize-tests) (just an example) choices. – progmatico Jan 02 '21 at 17:13
  • Maybe you should rewrite or post another question with emphasis on recommended ways to do cross-platform integration tests. That risks to be too broad but you can try. The answer may depend on the scale you are considering (just two OSes or multiple versions of them?) and your overall goals with your framework (is it an enterprise thing, or just a toy kind of thing). – progmatico Jan 02 '21 at 17:30

0 Answers0