Skip to content

Commit

Permalink
Merge pull request #23 from yazdipour/bugfix/attempt-to-fix-module-st…
Browse files Browse the repository at this point in the history
…ructure

Bugfix/attempt to fix module structure
  • Loading branch information
yazdipour authored Jun 18, 2024
2 parents 112921c + 6d73022 commit 54bf8a1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 23 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Unit Tests

on: [push, pull_request]
on: [push]

jobs:
test:
Expand All @@ -18,10 +18,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run unit tests
run: |
cd tests
python -m unittest test_omnivoreql.py
run: python -m unittest discover -s tests
env:
OMNIVORE_API_TOKEN: ${{ secrets.OMNIVORE_API_TOKEN }}
1 change: 1 addition & 0 deletions omnivoreql/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .omnivoreql import OmnivoreQL
from .models import CreateLabelInput
3 changes: 0 additions & 3 deletions omnivoreql/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from dataclasses import dataclass
from typing import Optional

from dataclasses import dataclass, field
from typing import Optional

Expand Down
8 changes: 4 additions & 4 deletions omnivoreql/omnivoreql.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
import uuid
from models import CreateLabelInput
from dataclasses import asdict
import os
import glob
from typing import List, Optional
from gql.transport.requests import RequestsHTTPTransport
from gql import gql, Client
from dataclasses import asdict
from .models import CreateLabelInput


class OmnivoreQL:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import setup
from setuptools import setup, find_packages
import subprocess


Expand Down Expand Up @@ -37,7 +37,7 @@ def read_requirements():
description="Omnivore API Client for Python",
author="Shahriar Yazdipour",
author_email="git@yazdipour.com",
packages=["omnivoreql"],
packages=find_packages(),
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
license="MIT",
Expand Down
18 changes: 9 additions & 9 deletions tests/test_omnivoreql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import unittest
import sys
from dotenv import load_dotenv

# Add the parent directory to the path to import the OmnivoreQL module
current_dir = os.path.dirname(os.path.abspath(__file__))
omnivoreql_dir = os.path.join(current_dir, "..", "omnivoreql")
sys.path.insert(0, omnivoreql_dir)
from omnivoreql import OmnivoreQL, CreateLabelInput


from omnivoreql.omnivoreql import OmnivoreQL
from omnivoreql.models import CreateLabelInput

"""
Unit tests for the OmnivoreQL client.
To run the tests, execute the following command:
python -m unittest discover -s tests
"""
class TestOmnivoreQL(unittest.TestCase):
client = None

Expand All @@ -21,13 +21,13 @@ def setUpClass(cls):
This method initializes the OmnivoreQL client with an API token.
The 'OMNIVORE_API_TOKEN' must be specified either in a '.env' file located in
the same directory as this script or passed directly when executing the test script.
Example command to run tests with an environment variable:
python -m unittest test_omnivoreql.py OMNIVORE_API_TOKEN='your_api_token_here'
Raises:
ValueError: If the 'OMNIVORE_API_TOKEN' is not set.
"""
print("\nStarting OmnivoreQL tests...\n")
api_token = cls.getEnvVariable("OMNIVORE_API_TOKEN")
if api_token is None:
raise ValueError("OMNIVORE_API_TOKEN is not set")
Expand Down

0 comments on commit 54bf8a1

Please sign in to comment.