concurrencytest icon indicating copy to clipboard operation
concurrencytest copied to clipboard

AttributeError: module 'os' has no attribute 'fork'

Open ikostan opened this issue 3 years ago • 0 comments

Hi all,

I am using Win 10 OS and it seems that windows does not support 'concurrencytest' (getting module 'os' has no attribute 'fork' error).

My virtual environment setup:

image

See logs attached:

C:\Users\superadmin\Documents\GitHub\DJANGO\testing_with_selenium_and_python\venv\Scripts\python.exe C:/Users/superadmin/Documents/GitHub/DJANGO/testing_with_selenium_and_python/tests/pythonorg_test/suite_all_tests_concurrent.py
Traceback (most recent call last):
  File "C:/Users/superadmin/Documents/GitHub/DJANGO/testing_with_selenium_and_python/tests/pythonorg_test/suite_all_tests_concurrent.py", line 30, in <module>
    runner.run(concurrent_suite)
  File "c:\users\superadmin\appdata\local\programs\python\python38-32\lib\unittest\runner.py", line 176, in run
    test(result)
  File "C:\Users\superadmin\Documents\GitHub\DJANGO\testing_with_selenium_and_python\venv\lib\site-packages\unittest2\suite.py", line 87, in __call__
    return self.run(*args, **kwds)
  File "C:\Users\superadmin\Documents\GitHub\DJANGO\testing_with_selenium_and_python\venv\lib\site-packages\testtools\testsuite.py", line 83, in run
    tests = self.make_tests(self)
  File "C:\Users\superadmin\Documents\GitHub\DJANGO\testing_with_selenium_and_python\venv\lib\site-packages\concurrencytest.py", line 69, in do_fork
    pid = os.fork()
AttributeError: module 'os' has no attribute 'fork'

My suite file:

import unittest
from concurrencytest import ConcurrentTestSuite, fork_for_tests
from tests.pythonorg_test.test_python_org_about import PythonOrgAboutTestCase
from tests.pythonorg_test.test_python_org_docs import PythonOrgDocsTestCase
from tests.pythonorg_test.test_python_org_home import PythonOrgHomeTestCase


def suite():
	suite_cases = unittest.TestSuite()

	# Home Test cases
	suite_cases.addTest(PythonOrgHomeTestCase('test_title'))
	suite_cases.addTest(PythonOrgHomeTestCase('test_url'))
	suite_cases.addTest(PythonOrgHomeTestCase('test_bad_search'))

	# Docs Test cases
	suite_cases.addTest(PythonOrgDocsTestCase('test_open_documentation'))

	# About Test cases
	suite_cases.addTest(PythonOrgAboutTestCase('test_upcoming_events'))

	return suite_cases


if __name__ == '__main__':
	runner = unittest.TextTestRunner(verbosity=2)
	suite = suite()
	# run 2 tests in parallel
	concurrent_suite = ConcurrentTestSuite(suite, fork_for_tests(2))
	runner.run(concurrent_suite)

ikostan avatar Sep 02 '20 06:09 ikostan