Skip to content

ben-251/ben-tests

Repository files navigation

Ben-tests

Unit-testing Framework

Installation

pip install bentests@git+https://github.com/ben-251/ben-tests.git

Updating

pip install --upgrade --force-reinstall bentests@git+https://github.com/ben-251/ben-tests.git

How to use

Import as with any library:

import bentests as b

Group tests with classes:

class FloatTests(b.testGroup):
	def testAlmostRight(self):
		b.assertAlmostEquals(1.0001,1,error_margin=3)

class ArithmeticTests(b.testGroup):
	def testSubtraction(self):
		b.assertEquals(1,2-1)
	
	def testZeroDivision(self):
		with b.assertRaises(ZeroDivisionError):
			v = 1/0 

Run tests in their groups:

b.test_all(FloatTests, ArithmeticTests, stats_amount="high")

Example Output:

Starting tests..

Running tests in "FloatTests":
Test passed.

Running tests in "ArithmeticTests":
Both tests passed. 

Tests Complete.
3 Tests run in 2 Groups:
All Tests Passed.

About

Unit testing Framework

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages