Corey Morris
commited on
Commit
•
de65005
1
Parent(s):
52d3b03
Added failing integration test. Currently fails because of the addition of the organization to the dataframe
Browse files- test_integration.py +43 -0
test_integration.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import subprocess
|
2 |
+
import time
|
3 |
+
import requests
|
4 |
+
import unittest
|
5 |
+
from app import find_top_differences_table
|
6 |
+
|
7 |
+
class TestAppFunctions(unittest.TestCase):
|
8 |
+
|
9 |
+
def setUp(self):
|
10 |
+
# Assuming that you have a ResultDataProcessor class or equivalent that provides the data
|
11 |
+
self.processor = ResultDataProcessor()
|
12 |
+
self.data = self.processor.data # Assuming this gives you the DataFrame you need
|
13 |
+
|
14 |
+
# def test_find_top_differences_table_error(self):
|
15 |
+
# # Define the variables that replicate the error
|
16 |
+
# closest_models = # define this based on your code
|
17 |
+
# exclude_columns = # define this based on your code
|
18 |
+
# selected_model_name = # define this based on your code
|
19 |
+
|
20 |
+
# # Run the problematic function without catching the TypeError
|
21 |
+
# top_differences_table, top_differences_tasks = find_top_differences_table(
|
22 |
+
# self.data, selected_model_name, closest_models, exclude_columns
|
23 |
+
# )
|
24 |
+
|
25 |
+
# If you wish to add any assertions related to the expected output, add them here
|
26 |
+
def test_streamlit_app_runs():
|
27 |
+
# Start the Streamlit app in a subprocess
|
28 |
+
process = subprocess.Popen(["streamlit", "run", "app.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
29 |
+
|
30 |
+
# Wait for a few seconds to give Streamlit time to start
|
31 |
+
time.sleep(5)
|
32 |
+
|
33 |
+
# Make a request to the Streamlit app's default URL to check that it's running
|
34 |
+
response = requests.get('http://localhost:8501')
|
35 |
+
|
36 |
+
# Terminate the process
|
37 |
+
process.terminate()
|
38 |
+
|
39 |
+
# Check that the response from the Streamlit app was successful
|
40 |
+
assert response.status_code == 200, "Streamlit app did not start successfully"
|
41 |
+
|
42 |
+
if __name__ == '__main__':
|
43 |
+
unittest.main()
|