toaster.lists.yoctoproject.org archive mirror
 help / color / mirror / Atom feed
From: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
To: toaster@lists.yoctoproject.org
Cc: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Subject: [PATCH v3 8/8] Toaster: Added pytest.ini file
Date: Thu,  9 Nov 2023 16:55:45 +0100	[thread overview]
Message-ID: <20231109155545.130758-8-alassane.yattara@savoirfairelinux.com> (raw)
In-Reply-To: <20231109155545.130758-1-alassane.yattara@savoirfairelinux.com>

The main reason for using pytest is to be able to generate a positive test report
using the pytest-html plugin.

Integrating Pytest with Tox is a straightforward process, this can be
done using tox.ini instead of pytest.ini used to configure pytest, that
is another reason for using pytest. Tox is a tool that automates testing
across different virtual environments, it can help ensure application
will be tested against multiple Python versions and environments.
https://github.com/pytest-dev/pytest/blob/main/tox.ini

Generated reports create a historical record of test results over time.
This can help track the progress of the application's stability and quality

Documentation and Transparency: Test reports provide us a clear and detailed
documentation of the test results. They show what tests were executed,
which ones passed, and which ones failed. This transparency is critical
for understanding the current state of the application and its test coverage.

Communication: Test reports are an effective means of communication among community
to understand the testing progress and results.

Debugging, Troubleshooting Historical Tracking and Regression Testing:
In case of test failures, a detailed test report can be invaluable for debugging.
It provides information about the specific test case that failed,
the input data used, and any error messages.

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
---
 lib/toaster/pytest.ini | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 lib/toaster/pytest.ini

diff --git a/lib/toaster/pytest.ini b/lib/toaster/pytest.ini
new file mode 100644
index 00000000..f07076b7
--- /dev/null
+++ b/lib/toaster/pytest.ini
@@ -0,0 +1,19 @@
+# -- FILE: pytest.ini (or tox.ini)
+[pytest]
+DJANGO_SETTINGS_MODULE = toastermain.settings_test
+
+python_files = db/test_*.py commands/test_*.py views/test_*.py browser/test_*.py functional/test_*.py
+
+# --create-db - force re creation of the test database
+# https://pytest-django.readthedocs.io/en/latest/database.html#create-db-force-re-creation-of-the-test-database
+
+# --html=report.html --self-contained-html
+# https://docs.pytest.org/en/latest/usage.html#creating-html-reports
+# https://pytest-html.readthedocs.io/en/latest/user_guide.html#creating-a-self-contained-report
+addopts = --create-db --html="Toaster Tests Report.html" --self-contained-html 
+
+# Define environment variables using pytest-env
+# A pytest plugin that enables you to set environment variables in the pytest.ini file.
+# https://pypi.org/project/pytest-env/
+env =
+    TOASTER_BUILDSERVER=1
-- 
2.34.1



      parent reply	other threads:[~2023-11-09 15:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 15:55 [PATCH v3 1/8] Toaster: Update toaster-requirements.txt to add pytest and some plugin's Alassane Yattara
2023-11-09 15:55 ` [PATCH v3 2/8] Toaster: Update orm.models to catch error ProcessLookupError Alassane Yattara
2023-11-09 15:55 ` [PATCH v3 3/8] Toaster: Bug-fix pytest and Failed: Database access not allowed Alassane Yattara
2023-11-09 15:55 ` [PATCH v3 4/8] Toaster: fixed pytest error: Database access not allowed, use the "django_db" Alassane Yattara
2023-11-09 15:55 ` [PATCH v3 5/8] Toaster: Bug-fix django.db.utils.IntegrityError: Problem installing fixture Alassane Yattara
2023-11-09 15:55 ` [PATCH v3 6/8] Toaster: Move toaster tests requirements in bitbake/lib/toaster/toaster-tests-requirements Alassane Yattara
2023-11-09 16:29   ` [Toaster] " Richard Purdie
2023-11-09 15:55 ` [PATCH v3 7/8] Toaster: fixed: Tests fail when executed one after the other out of sequence Alassane Yattara
2023-11-09 15:55 ` Alassane Yattara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231109155545.130758-8-alassane.yattara@savoirfairelinux.com \
    --to=alassane.yattara@savoirfairelinux.com \
    --cc=toaster@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).