From 4aa3a4ec266e8e74bf29adc36129181b5802311c Mon Sep 17 00:00:00 2001 From: Anton Hansson <antha652@student.liu.se> Date: Fri, 30 Sep 2022 21:22:07 +0000 Subject: [PATCH] Update tests/test_router.py, .gitlab-ci.yml --- .gitlab-ci.yml | 23 ++++++++++++++++------- tests/test_router.py | 21 ++++++++++----------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 05681e9..8f6f269 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,16 @@ -run_tests: - stage: test - image: python:3.9 - before_script: - - pip install -r requirements.txt - script: - - python -m unittest discover tests +image: "python:3.7" + +before_script: + - python --version + - pip install -r requirements.txt + +stages: + - Static Analysis + - Test + +... + +pytest: + stage: Test + script: + - pytest diff --git a/tests/test_router.py b/tests/test_router.py index 9ecd3d8..54cfba9 100644 --- a/tests/test_router.py +++ b/tests/test_router.py @@ -1,15 +1,14 @@ -import unittest +def test_uppercase(): + assert "loud noises".upper() == "LOUD NOISES" -class TestSum(unittest.TestCase): - def test_list_int(self): - """ - Test that it can sum a list of integers - """ - data = [1, 2, 3] - result = sum(data) - self.assertEqual(result, 6) +def test_reversed(): + assert list(reversed([1, 2, 3, 4])) == [4, 3, 2, 1] -if __name__ == '__main__': - unittest.main() +def test_some_primes(): + assert 37 in { + num + for num in range(2, 50) + if not any(num % div == 0 for div in range(2, num)) + } \ No newline at end of file -- GitLab