Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Integration test for successful app start #218

Open
clstaudt opened this issue Feb 9, 2023 · 12 comments
Open

Test: Integration test for successful app start #218

clstaudt opened this issue Feb 9, 2023 · 12 comments
Labels
distribution good first issue Good for newcomers help wanted Extra attention is needed

Comments

@clstaudt
Copy link
Contributor

clstaudt commented Feb 9, 2023

First attempt: This is not yet working since the app process does not terminate.

def test_app_starts_and_quits():
    # Start the app process
    app_process = subprocess.Popen(["python", "app/app.py"])
    
    # Wait for a few seconds to let the app start
    time.sleep(3)
    
    # Verify the process is still running
    assert app_process.poll() is None
    
    # Terminate the app process
    app_process.terminate()
    
    # Wait for the process to end
    app_process.wait()
    
    # Verify the process has ended

    assert app_process.returncode is not None
@clstaudt clstaudt converted this from a draft issue Feb 9, 2023
@clstaudt clstaudt added the good first issue Good for newcomers label Feb 9, 2023
@clstaudt clstaudt changed the title Test: Test successful app start Test: Integration test for successful app start Feb 9, 2023
@clstaudt clstaudt added help wanted Extra attention is needed distribution labels Feb 9, 2023
@AmanSal1
Copy link

AmanSal1 commented Feb 9, 2023

urllib.error.HTTPError: HTTP Error 404: Not Found

i am getting this error while running your "python app/app.py" command in python virtual env

@clstaudt
Copy link
Contributor Author

clstaudt commented Feb 9, 2023

Hi @AmanSal1, could you please open a separate issue to tell us more about the error you are seeing:

  • the full terminal output, including your command
  • the steps you took to install the app

Thanks!

@AmanSal1
Copy link

@clstaudt compiled it !! now working fine

would work on your bug now

@AmanSal1
Copy link

AmanSal1 commented Feb 10, 2023

can you explain in brief about the the issue ?
like you want to implement this fuction ??

Test: Integration test for successful app start #218

@clstaudt
Copy link
Contributor Author

clstaudt commented Feb 10, 2023

Good news @AmanSal1

We welcome your contribution. The task is to implement a test that tests whether the app starts and quits successfully, as part of the test suite in tuttle_tests.

Here's how you can proceed:

  1. have a look at the unit test suite, run it with pytest and check that everything is green
  2. add a new test module tuttle_tests/test_app.py
  3. add a function test_app_starts_and_quits and start developing

Here's how to contribute:

  1. work on a new branch branching off the dev branch (e.g. test-app)
  2. create a new pull request for that branch
  3. mark it as draft as long as it is unfinished
  4. assign me as a reviewer if ready
  5. ask me anything in the discussion of the pull request if you need support

@AmanSal1
Copy link

@clstaudt as if now there is no module to test that the app starts and quits successfully,so we have to implement a function to check it ? right ?

@clstaudt
Copy link
Contributor Author

clstaudt commented Feb 10, 2023

@AmanSal1 Correct, currently there is no test in the test suite that would catch any error that prevents the app from starting.

The test suite is run via the GitHub CI pipeline after every commit - which then shows ✅ or ❌.

@AmanSal1
Copy link

Sorry to disturb you again and again but i am bit confused because as i tried to comment out build method in app.py and then run it so it gave me an error .
so basically it is show which module is preventing to start the app

so exatly what do you want ?

tuttle
tuttle 2

@clstaudt
Copy link
Contributor Author

@AmanSal1 A unit test that would fail on such an error would be great.

Also, any test that fails when the app fails to start properly.

@AmanSal1
Copy link

@clstaudt thank you for the explanation i got the clarity will work on it now

@clstaudt
Copy link
Contributor Author

@AmanSal1 Another reason why we need such tests: A developer used a feature from Python 3.10. With Python 3.9 it's a syntax error that prevents the app from starting. No developer noticed because everyone was working with 3.10. That's where automatic tests come in, to quickly test things across environments.

@AmanSal1
Copy link

@clstaudt yes yes i got your point faced a same issue when i was trying to compile some other github projects .
I am working towards it will get back to you if something positive happens

@clstaudt clstaudt moved this from Todo to Backlog in Tuttle Dev Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distribution good first issue Good for newcomers help wanted Extra attention is needed
Projects
Status: Backlog
Development

No branches or pull requests

2 participants