# Clone the repository to your local machine
; git clone https://github.com/JonnySB/makers-007-engineering-project-1.git
; cd makers-007-engineering-project-1
# Install dependencies and set up the virtual environment
; pipenv install
# Activate the virtual environment
; pipenv shell
# Install the virtual browser we will use for testing
; playwright install
# If you have problems with the above, contact your coach
# Create a test and development database
; createdb MAKERS_BNB
; createdb MAKERS_BNB_test
# Seed the development database (ensure you have run `pipenv shell` first)
; python seed_dev_database.py
# Run the tests (with extra logging)
; pytest -sv
# Run the app
; python app.py
#Visit http://localhost:5001/spaces in your browser
When in the branch you're working in, and you're happy with all your changes, use the following:
git add .
git commit -m "Your commit message"
git push
Switch to the main branch and pull any changes from there:
git checkout main
git pull origin main
For example:
➜ makers-007-engineering-project-1 git:(story-2-list-spaces) git checkout main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
➜ makers-007-engineering-project-1 git:(main) git pull
remote: Enumerating objects: 66, done.
remote: Counting objects: 100% (62/62), done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 42 (delta 23), reused 33 (delta 14), pack-reused 0
Unpacking objects: 100% (42/42), 9.66 KiB | 309.00 KiB/s, done.
From https://github.com/JonnySB/makers-007-engineering-project-1
e548da6..086f6bf branch_user_story1 -> origin/branch_user_story1
f245360..eb5efea story_7 -> origin/story_7
Already up to date.
Switch to your branch and merge it with the main branch.
git checkout your-branch-name
git fetch
git merge origin/main
For example:
➜ makers-007-engineering-project-1 git:(main) git checkout story-2-list-spaces
Switched to branch 'story-2-list-spaces'
Your branch is up to date with 'origin/story-2-list-spaces'.
➜ makers-007-engineering-project-1 git:(story-2-list-spaces) git fetch
➜ makers-007-engineering-project-1 git:(story-2-list-spaces) git merge origin/main
Merge made by the 'ort' strategy.
lib/booking.py | 15 +++++++++++++--
lib/users.py | 12 ++++++++++++
tests/test_booking.py | 19 +++++++++++++++++++
3 files changed, 44 insertions(+), 2 deletions(-)
create mode 100644 lib/users.py
create mode 100644 tests/test_booking.py
Once you've merged your branch with the main, open your virtual environment and retest all your code with pytest and also checking the html pages are working appropriately.
For example:
➜ makers-007-engineering-project-1 git:(story-2-list-spaces) pipenv shell
Launching subshell in virtual environment...
. /Users/mattwshepherd/.local/share/virtualenvs/makers-007-engineering-project-1-Tkx7Kyu9/bin/activate
➜ makers-007-engineering-project-1 git:(story-2-list-spaces) . /Users/mattwshepherd/.local/share/virtualenvs/makers-007
-engineering-project-1-Tkx7Kyu9/bin/activate
(makers-007-engineering-project-1) ➜ makers-007-engineering-project-1 git:(story-2-list-spaces) pytest
================================================== test session starts ==================================================
platform darwin -- Python 3.11.2, pytest-7.4.3, pluggy-1.3.0
rootdir: /Users/mattwshepherd/Documents/MakersCode/06_engineering_project_1/makers-007-engineering-project-1
plugins: xprocess-0.23.0, playwright-0.4.3, base-url-2.0.0
collected 8 items
tests/test_app.py . [ 12%]
tests/test_booking.py .. [ 37%]
tests/test_database_connection.py . [ 50%]
tests/test_space.py ... [ 87%]
tests/test_space_repository.py . [100%]
=================================================== 8 passed in 1.90s ==================================================
➜ makers-007-engineering-project-1 git:(story-2-list-spaces) . /Users/mattwshepherd/.local/share/virtualenvs/makers-007
-engineering-project-1-Tkx7Kyu9/bin/activate
(makers-007-engineering-project-1) ➜ makers-007-engineering-project-1 git:(story-2-list-spaces) python app.py
* Serving Flask app 'app'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5001
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 114-236-802
127.0.0.1 - - [10/Jan/2024 10:54:48] "GET /spaces?vscodeBrowserReqId=1704884088786 HTTP/1.1" 200 -
^C%
If you're happy and there are no changes, exit your virtual environment.
For example:
(makers-007-engineering-project-1) ➜ makers-007-engineering-project-1 git:(story-2-list-spaces) exit
If there were changes, repeat step 1 and do another pull to check there aren't any changes from main.
Push your final changes when you're happy.
git push origin your-branch-name
Or if you're in your branch, just use
git push
If you've successfully completed steps 1-5, and would like your branch to be merged onto the main branch, open up a pull request and ask for your team to review it.
Caution
Make sure you do not just merge the changes FROM YOUR BRANCH to MAIN yourself! Ensure everyone has reviewed and approved your code first
If there are any issues with your code, make the appropriate changes and repeat steps 1-5.
Note
If you have opened a pull request, any commits after that will be shown in that pull request so ensure your pull request is reviewed before you continue working on that branch.
If everything is approved and you merge your branch to the main branch, drop a message in the Slack channel to notify everyone to pull these changes.