Artificial-superintelligence commited on
Commit
ad8639b
·
verified ·
1 Parent(s): f1b1d8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -106,7 +106,16 @@ def interact_with_cloud_services(service_name, action, params):
106
 
107
  def run_tests():
108
  """Run automated tests using unittest."""
109
- test_suite = unittest.TestLoader().discover('tests')
 
 
 
 
 
 
 
 
 
110
  test_runner = unittest.TextTestRunner()
111
  test_result = test_runner.run(test_suite)
112
  return test_result
 
106
 
107
  def run_tests():
108
  """Run automated tests using unittest."""
109
+ # Ensure the tests directory is importable
110
+ tests_dir = os.path.join(os.getcwd(), 'tests')
111
+ if not os.path.exists(tests_dir):
112
+ os.makedirs(tests_dir)
113
+ init_file = os.path.join(tests_dir, '__init__.py')
114
+ if not os.path.exists(init_file):
115
+ with open(init_file, 'w') as f:
116
+ f.write('')
117
+
118
+ test_suite = unittest.TestLoader().discover(tests_dir)
119
  test_runner = unittest.TextTestRunner()
120
  test_result = test_runner.run(test_suite)
121
  return test_result