forked from brwali/PopcornPicks
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/se24ncsu/PopcornPicks into …
…tests
- Loading branch information
Showing
8 changed files
with
76 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
# .coveragerc | ||
|
||
[run] | ||
include = src/recommenderapp/*,src/prediction_scripts/* | ||
source = . | ||
omit = | ||
*/test/* | ||
*/tests/* | ||
*/venv/* | ||
setup.py | ||
|
||
[report] | ||
exclude_lines = | ||
pragma: no cover | ||
def __repr__ | ||
raise NotImplementedError | ||
if __name__ == .__main__.: | ||
pass | ||
raise ImportError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
build | ||
.git | ||
.DS_Store | ||
.env | ||
*.pyc | ||
_pycache_/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,31 @@ | ||
name: Unittest | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: [main, workflows] | ||
schedule: | ||
- cron: '00 23 * * *' | ||
on: [push] | ||
|
||
jobs: | ||
build: | ||
upload-coverage: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
env: | ||
MONGO_URI: ${{ secrets.MONGO_URI }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
python-version: 3.9 # Replace '3.x' with your desired Python version | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Set up MongoDB Client for Tests | ||
env: | ||
MONGO_URI: "mongodb+srv://svrao3:popcorn1234@popcorn.xujnm.mongodb.net/?retryWrites=true&w=majority&appName=PopCorn" | ||
- name: Create env file | ||
run: | | ||
python -c " | ||
import os | ||
from pymongo import MongoClient | ||
uri = os.getenv('MONGO_URI') | ||
client = MongoClient(uri) | ||
try: | ||
client.admin.command('ping') | ||
print('Successfully connected to MongoDB Atlas!') | ||
client.close() | ||
except Exception as e: | ||
print('MongoDB connection failed:', e) | ||
exit(1) | ||
" | ||
echo "CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}" > .env | ||
echo "MONGO_URI=${{ secrets.MONGO_URI }}" >> .env | ||
- name: Run Unit Tests | ||
env: | ||
MONGO_URI: "mongodb+srv://svrao3:popcorn1234@popcorn.xujnm.mongodb.net/?retryWrites=true&w=majority&appName=PopCorn" | ||
run: | | ||
python -m unittest discover -s test -p "*.py" | ||
- name: Test with pytest | ||
run: pytest --tb=line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
This script will create a .env file with environment variables. | ||
""" | ||
|
||
env_variables = { | ||
"MONGO_URI": "mongodb+srv://svrao3:popcorn1234@popcorn.xujnm.mongodb.net", | ||
} | ||
|
||
with open(".env", "w", encoding="utf-8") as env_file: | ||
for key, value in env_variables.items(): | ||
env_file.write(f"{key}={value}\n") | ||
|
||
print(".env file has been created with your environment variables.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters