Skip to content
Snippets Groups Projects
Commit c7e4f34a authored by Felipe Delestro Matos's avatar Felipe Delestro Matos
Browse files

CI/CD

parent 9f3b2127
No related branches found
No related tags found
No related merge requests found
Pipeline #17514 passed
...@@ -5,12 +5,12 @@ This is an example repository of how Python projects should be organized as at Q ...@@ -5,12 +5,12 @@ This is an example repository of how Python projects should be organized as at Q
On the root of the repository, at minimum you should have: On the root of the repository, at minimum you should have:
- README.md - README.md
- LICENSE - LICENSE
- An `.gitignore` file (you can use the one from here as a base template) - `.gitignore` file (you can use the one from here as a base template)
- A single `project_name` directory that contains all the main code - A single `project_name` directory that contains all the main code
- requirements.txt (for the pip requirements) - requirements.txt (for the pip requirements)
Depending on your project, you might also have: Depending on your project, you might also have:
- y - `.gitlab-ci.yml` for the CI/CD pipeline
### Code directory ### Code directory
Use a simple but meaningful name, as this is the name you're project is going to be imported in case it is packed as a library. Use a simple but meaningful name, as this is the name you're project is going to be imported in case it is packed as a library.
...@@ -25,8 +25,8 @@ Details of the coding guidelines can be found at the [QIM Gitlab Wiki](https://l ...@@ -25,8 +25,8 @@ Details of the coding guidelines can be found at the [QIM Gitlab Wiki](https://l
In summary: In summary:
- Use Google style for docstrings. - Use Google style for docstrings.
- Do not add files larger than 32MB, unless stricly necessary. - Raise errors when necessary.
- Avoid large files.
## Testing ## Testing
......
...@@ -11,7 +11,10 @@ def say_hello(user): ...@@ -11,7 +11,10 @@ def say_hello(user):
>>> say_hello('Alice') >>> say_hello('Alice')
'Hello Alice!' 'Hello Alice!'
""" """
if not isinstance(user, str):
raise TypeError("The 'user' argument must be a string.")
str = (f'Hello {user}!') greeting = (f'Hello {user}!')
return greeting
return str
\ No newline at end of file
import qimex import qimex
import pytest
def test_say_hello(): def test_say_hello():
user = "Alice" user = "Alice"
expected_output = "Hello Alice!" expected_output = "Hello Alice!"
result = qimex.examples.say_hello(user) result = qimex.examples.say_hello(user)
assert result == expected_output assert result == expected_output
def test_say_hello_with_non_string():
""" Tests if the correct error is raised"""
user = 123 # Non-string argument
with pytest.raises(TypeError):
qimex.examples.say_hello(user)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment