isabelrem / 2023-Software-Development-Assessment

MIT License
2 stars 1 forks source link

Functional testing #63

Closed jess789550 closed 8 months ago

jess789550 commented 8 months ago

https://stackoverflow.com/questions/54416550/how-to-pass-multiple-arguments-in-pytest-using-command-line

jess789550 commented 8 months ago

https://pypi.org/project/pytest-docker/

jess789550 commented 8 months ago

https://forum.gitlab.com/t/how-to-run-pytest-with-fixtures-that-spin-up-docker-containers/57190

jess789550 commented 8 months ago

https://pypi.org/project/pytest-docker-tools/

jess789550 commented 8 months ago

https://xnuinside.medium.com/integration-testing-for-bunch-of-services-with-pytest-docker-compose-4892668f9cba

jess789550 commented 8 months ago

https://pavolkutaj.medium.com/simulating-single-and-multiple-inputs-using-pytest-and-monkeypatch-6968274f7eb9

jess789550 commented 8 months ago

@isabelrem do you think we can modify the docker files to allow testing to be run within the docker container?

jess789550 commented 8 months ago

Functional testing done. SQL tests written too but I've lost connection to the cloud database. Docs have been updated too.

isabelrem commented 8 months ago

(base) isabel@mokaguys-HP-EliteBook-840-G3 ~/GITHUB/2023-Software-Development-Assessment $ pytest -vv ====================================================================== test session starts ====================================================================== platform linux -- Python 3.9.13, pytest-7.4.4, pluggy-1.3.0 -- /home/isabel/miniconda3/bin/python cachedir: .pytest_cache rootdir: /home/isabel/GITHUB/2023-Software-Development-Assessment collected 35 items

Tests/test_API_to_SQL_cloud.py::test_PK_Parse_Data_to_SQL_cloud_works PASSED [ 2%] Tests/test_API_to_SQL_cloud.py::test_PK_Parse_Data_to_SQL_cloud_type_errors PASSED [ 5%] Tests/test_API_to_SQL_cloud.py::test_PK_Parse_Data_to_SQL_cloud_value_errors PASSED [ 8%] Tests/test_PanelApp_API_Request.py::test_request_data PASSED [ 11%] Tests/test_PanelApp_API_Request.py::test_pk_search PASSED [ 14%] Tests/test_PanelApp_API_Request.py::test_r_search_works PASSED [ 17%] Tests/test_PanelApp_API_Request.py::test_r_search_fails PASSED [ 20%] Tests/test_PanelApp_Request_Parse.py::test_panelapp_search_parse_works PASSED [ 22%] Tests/test_PanelApp_Request_Parse.py::test_panelapp_search_parse_fails PASSED [ 25%] Tests/test_SQL_Cloud_Functions.py::test_docker_or_cloud_works PASSED [ 28%] Tests/test_SQL_Cloud_Functions.py::test_connect_cloud_db_works PASSED [ 31%] Tests/test_SQL_Cloud_Functions.py::test_add_new_cloud_record_works PASSED [ 34%] Tests/test_SQL_Cloud_Functions.py::test_browse_cloud_records_no_id PASSED [ 37%] Tests/test_SQL_Cloud_Functions.py::test_browse_cloud_records_with_id_and_tables PASSED [ 40%] Tests/test_SQL_Cloud_Functions.py::test_browse_cloud_records_with_id_only PASSED [ 42%] Tests/test_SQL_Cloud_Functions.py::test_browse_cloud_records_wrong_id PASSED [ 45%] Tests/test_SQL_Cloud_Functions.py::test_download_records FAILED [ 48%] Tests/test_VV_API_Request.py::test_genome_build_convert_GRch37 PASSED [ 51%] Tests/test_VV_API_Request.py::test_genome_build_convert_fails PASSED [ 54%] Tests/test_VV_API_Request.py::test_request_data_works PASSED [ 57%] Tests/test_VV_API_Request.py::test_gene_to_transcripts_works PASSED [ 60%] Tests/test_VV_Request_Parse.py::test_vv_request_parse PASSED [ 62%] Tests/test_functional.py::test_main_works PASSED [ 65%] Tests/test_generate_bed.py::test_parse_panel_data PASSED [ 68%] Tests/test_generate_bed.py::test_write_bed_file_works PASSED [ 71%] Tests/test_generate_bed.py::test_write_bed_file_no_filename PASSED [ 74%] Tests/test_generate_bed.py::test_write_bed_file_no_beds PASSED [ 77%] Tests/test_main.py::test_get_genome_build_works PASSED [ 80%] Tests/test_main.py::test_get_genome_build_errors PASSED [ 82%] Tests/test_main.py::test_get_input_string_type_works PASSED [ 85%] Tests/test_main.py::test_get_input_string_type_errors PASSED [ 88%] Tests/test_main.py::test_get_input_string PASSED [ 91%] Tests/test_main.py::test_create_bed_filename PASSED [ 94%] Tests/test_select_disease.py::test_find_match_works PASSED [ 97%] Tests/test_select_disease.py::test_find_match_errors PASSED [100%]

=========================================================================== FAILURES ============================================================================ _ test_downloadrecords

def test_download_records():
    """
    Test download_record() function downloads SQL record as CSV files
    """
  result = browse_cloud_records("Patient 1")  # Get tables from database

Tests/test_SQL_Cloud_Functions.py:75:


PanelSearch/SQL_Cloud_Functions.py:217: in browse_cloud_records searches_request = input("Would you like to see the searches information for this patient? (Y/N) \n")


self = <_pytest.capture.DontReadFromInput object at 0x7f80c02cdb20>, size = -1

def read(self, size: int = -1) -> str:
  raise OSError(

"pytest: reading from stdin while output is captured! Consider using -s." ) E OSError: pytest: reading from stdin while output is captured! Consider using -s.

../../miniconda3/lib/python3.9/site-packages/_pytest/capture.py:202: OSError --------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------- successful connection to sql database

Patients table for: Patient 1

id patient_id search_id 0 1 Patient 1 1 Would you like to see the searches information for this patient? (Y/N) ==================================================================== short test summary info ==================================================================== FAILED Tests/test_SQL_Cloud_Functions.py::test_download_records - OSError: pytest: reading from stdin while output is captured! Consider using -s. ================================================================= 1 failed, 34 passed in 54.24s =================================================================