Using Sys.Argv's With Pytest #8783
-
Hi Everyone, Im a beginner at python, I wanted to make a program that'll take sys_args and generate a password.
Here's my code: def main():
proceed = sys.argv[1]
if proceed == 'make':
count = int(sys.argv[2])
make_name(count)
else:
ti= time.time()
name = sys.argv[2]
count = sys.argv[3]
if count == 'all':
count = 'all'
make_salt(count, name)
else:
make_salt(count, name)
print(f"Time Taken: {round(time.time() - ti, 2)}s") |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Pytest is a own cli program with own cli handling If you want to test a cli you have to do what everyone else is doing and enable your main function to take an alternative to sys.argv I can elaborate once I get back to the computer later if necessary |
Beta Was this translation helpful? Give feedback.
Pytest is a own cli program with own cli handling
If you want to test a cli you have to do what everyone else is doing and enable your main function to take an alternative to sys.argv
I can elaborate once I get back to the computer later if necessary