You are on page 1of 5

1.

Install Python Modules


 pip install pytest
 pip install virtualenv
- pip or pip3 command can/must be used depending on python installation
- pytest is test framework for Python
o https://docs.pytest.org/en/7.4.x/
- virtualenv is a package to create virtual environments for python
o it has more features than the built-in package venv
o https://www.freecodecamp.org/news/how-to-setup-virtual-environments-in-
python/

2. Download, copy and extract the package crud-app-demo.zip. Open a terminal and go inside
crud-app-demo directory. The package should contain the following.

WSL

Command Prompt

3. Create Virtual Environment


- create a virtual environment named ‘myenv’
 python -m virtualenv myenv
- python or python3 command can/must be used depending on python installation
- in WSL/Linux, the following will also work
 virtualenv myenv
- a new directory named ‘myenv’ will generated containing a separate python installation
WSL

Command Prompt
4. Activate Virtual Environment
WSL
 source myenv/bin/activate

Command Prompt
 .\myenv\Scripts\activate

- Notice the (myenv) prefix in the command prompt to show that the virtual environment
is already activated
- ‘where’ or ‘which’ command will also show the path of the current python interpreter

5. Install Dependencies
- In most Python projects, the dependencies are usually specified in a file called
‘requirements.txt’
 pip install -r requirements.txt
6. Run the python application
- in this package, the name of the application is app_basic.py
- there is also another app containing the demo of customtkinter library

 python ./app_basic.py

- you can try the buttons the create(button), read (highlight an entry), update(button) and
delete(button) employee

 python ./moderngui.py
7. Most applications also contain some tests. Run the tests of the python application using
pytest.
- In this example, there is test for the database interface named test_db_if.py
 pytest test_db_if.py

- running the test will populate the database. The database file is Employees.db

- If you re-run the application, you will observe that some entries are already available

- Note that some column entries does not match because the intent of the test is for the
database interface.

You might also like