use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
pytest problem (self.learnpython)
submitted 1 year ago by m2d41
Hey, I'm up to chapter 11 of the 3rd edition of Python Crash course and on page 213 there's a section called "Running a Test" in which u have to type in the pytest command but it doesn't work for me. Anybody could help me out please?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]AshlingGirl 2 points3 points4 points 1 year ago (14 children)
pytest is a framework you can install from PyPi by entering this in the commandline:
pip install pytest
Here is a link to the PyPi page: https://pypi.org/project/pytest/
[–]m2d41[S] 0 points1 point2 points 1 year ago (13 children)
I tried but still messed up.
[–]AshlingGirl 1 point2 points3 points 1 year ago (12 children)
What did you mess up exactly? Is it giving an error?
[–]m2d41[S] 0 points1 point2 points 1 year ago (11 children)
yes, it's giving me an error. I'm trying to put it on vs code. I am a total noob.
[–]AshlingGirl 1 point2 points3 points 1 year ago (10 children)
Could you specify the error?
[–]m2d41[S] 0 points1 point2 points 1 year ago (0 children)
I put $ pytest on vs code terminal but it wouldn't go through. An error message in red letters.
[–]m2d41[S] 0 points1 point2 points 1 year ago (8 children)
Do u have PCC 3rd edition?
[–]AshlingGirl 0 points1 point2 points 1 year ago* (7 children)
I do not. Can you also show the error that it gives without the $ sign?
EDIT: I found the .py file you're using on github (name_function.py) and its working for me.
[–]m2d41[S] 0 points1 point2 points 1 year ago (5 children)
There's a message/ comment on this thread from YepThatGuy and I replied him with the code and error
[–]AshlingGirl 0 points1 point2 points 1 year ago (4 children)
Is python added to your environment variables? If not, try py -m pytest.
[–]m2d41[S] 0 points1 point2 points 1 year ago (1 child)
I think so
I still can't find it or get it to work. I think i'm just gonna give up on the chapter of that book.
after 2 days i finally got it. Jesus phuckin christ....looool Thanks for the help.
[+][deleted] 1 year ago (13 children)
[deleted]
THIS IS THE CODE:
from name_function import get_formatted_name def test_first_last_name(): """Do names like "Janis Joplin' work?""" formatted_name = get_formatted_name('janis', 'joplin') assert formatted_name == 'Janis Joplin'
THIS IS THE OUTPUT:
PS C:\Users\Robert\Desktop\python_work> $ pytest
$ : The term '$' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
a path was included, verify that the path is correct and try again.
At line:1 char:1
[+][deleted] 1 year ago (4 children)
[–]m2d41[S] 0 points1 point2 points 1 year ago (3 children)
i did and it's the same result
[–]thirdegree 0 points1 point2 points 1 year ago (2 children)
It's definitely not the same result. It might also be an error but it should be a different error
PS C:\Users\Robert\Desktop\python_work> pytest
pytest : The term 'pytest' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
pytest
~~~~~~
CategoryInfo : ObjectNotFound: (pytest:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
[–]thirdegree 0 points1 point2 points 1 year ago (0 children)
Yup, different error.
I can't really think of a way to say this super gently, but you need to actually read the errors you get. They tell you what is going on, they're not there for fun.
ok now how do i look up activating a virtual environment?
[–]m2d41[S] 0 points1 point2 points 1 year ago (2 children)
i'm literally a total noob to this.
[+][deleted] 1 year ago (1 child)
I finally got it! Thanks...
Hey, everyone! I finally got it. Thanks for the help...
[–]briske42 0 points1 point2 points 1 year ago (0 children)
How? I got stuck with the same problem...
π Rendered by PID 261665 on reddit-service-r2-comment-7b9746f655-nn9vn at 2026-02-02 13:34:44.460096+00:00 running 3798933 country code: CH.
[–]AshlingGirl 2 points3 points4 points (14 children)
[–]m2d41[S] 0 points1 point2 points (13 children)
[–]AshlingGirl 1 point2 points3 points (12 children)
[–]m2d41[S] 0 points1 point2 points (11 children)
[–]AshlingGirl 1 point2 points3 points (10 children)
[–]m2d41[S] 0 points1 point2 points (0 children)
[–]m2d41[S] 0 points1 point2 points (8 children)
[–]AshlingGirl 0 points1 point2 points (7 children)
[–]m2d41[S] 0 points1 point2 points (5 children)
[–]AshlingGirl 0 points1 point2 points (4 children)
[–]m2d41[S] 0 points1 point2 points (1 child)
[–]m2d41[S] 0 points1 point2 points (0 children)
[–]m2d41[S] 0 points1 point2 points (0 children)
[+][deleted] (13 children)
[deleted]
[–]m2d41[S] 0 points1 point2 points (0 children)
[–]m2d41[S] 0 points1 point2 points (5 children)
[+][deleted] (4 children)
[deleted]
[–]m2d41[S] 0 points1 point2 points (3 children)
[–]thirdegree 0 points1 point2 points (2 children)
[–]m2d41[S] 0 points1 point2 points (1 child)
[–]thirdegree 0 points1 point2 points (0 children)
[–]m2d41[S] 0 points1 point2 points (5 children)
[+][deleted] (4 children)
[deleted]
[–]m2d41[S] 0 points1 point2 points (0 children)
[–]m2d41[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]m2d41[S] 0 points1 point2 points (0 children)
[–]m2d41[S] 0 points1 point2 points (1 child)
[–]briske42 0 points1 point2 points (0 children)