I am trying to create the configuring for pytest, but I'm am getting an error

  • Thread starter rgtr
  • Start date
  • Tags
    Error
In summary, the conversation is about an issue with a missing argument in the make_app_run_in_test_env function in the conftest.py file of a python flask code. The error message suggests that the missing argument is causing the issue, and the solution is to add the argument to the function definition and pass it in when calling the function.
  • #1
rgtr
92
8
TL;DR Summary
I am trying to create the configuring for pytest. For some reason I am getting the error "missing 1 required positional argument: 'start_response'".
I just don't know how to fix this. I linked my github and the complete error message below.
Can someone help?
Also the code is in python flask.

Here is the code updated https://github.com/NML240/flaskblog2 Here are 2 relevant files https://github.com/NML240/flaskblog2/blob/main/app/config.py and https://github.com/NML240/flaskblog2/blob/main/app/tests/conftest.py.

In conftest.py I created config function to set up for pytest but I am getting an error.
Here is the complete error.
Here is the relevant error.
Code:
typeError: call() missing 1 required positional argument: 'start_response'
. I am not sure if this is caused by the function make_app_run_in_test_env or create_app function.

My guess from the error message is the former function.
Any idea how to fix this?
Thanks
 
Technology news on Phys.org
  • #2
The issue is that the make_app_run_in_test_env function is missing a required argument. The function expects a parameter called "start_response" but it is not being passed in. You need to add the parameter to the function definition and pass it in when calling the function. def make_app_run_in_test_env(start_response): app = create_app("testing") ...make_app_run_in_test_env(start_response)
 

FAQ: I am trying to create the configuring for pytest, but I'm am getting an error

What is pytest and what is it used for?

Pytest is a testing framework for Python programs. It is used to automate the testing process, making it easier and more efficient for developers to test their code.

How do I install and configure pytest?

To install pytest, you can use the pip package manager by running the command "pip install pytest" in your command line. To configure pytest for your project, you can create a pytest.ini file in your project's root directory and add any necessary configurations.

Why am I getting an error when trying to configure pytest?

There could be several reasons for this error. It could be due to incorrect syntax in your pytest.ini file, missing dependencies, or conflicts with other testing frameworks. It's important to carefully review your configurations and troubleshoot any potential issues.

How do I fix errors in my pytest configurations?

The first step to fixing errors in your pytest configurations is to carefully review the error message and try to identify the source of the problem. You can also refer to the pytest documentation or seek help from online communities or forums. If all else fails, you may need to seek assistance from a more experienced developer.

Is pytest the best testing framework for my project?

It ultimately depends on your specific project and needs. While pytest is a popular and widely used testing framework, there may be other options that better suit your project. It's important to research and compare different testing frameworks to determine the best fit for your project.

Similar threads

Back
Top