Skip to content

Commit

Permalink
to change unit test to pytest (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyougithub authored Sep 16, 2022
1 parent 26cf2f7 commit 0bf39cd
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ source bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
nosetests
python -m pytest
```

External requirements set-up:
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
testpaths = tests
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nose==1.3.7
pytest>=6.0.1
freezegun==1.2.2
Empty file added tests/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/common_test/cve_reader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from unittest import TestCase
from unittest.mock import MagicMock, call
from datetime import datetime
from fixtures import freeze_time, async_test, ClientSessionMock
from tests.fixtures import freeze_time, async_test, ClientSessionMock
from aiohttp.test_utils import make_mocked_coro

from openwebvulndb.common.errors import VulnerabilityNotFound
Expand Down
2 changes: 1 addition & 1 deletion tests/common_test/hash_collector_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from unittest.mock import MagicMock, call, patch, mock_open
from contextlib import contextmanager

from fixtures import async_test
from tests.fixtures import async_test
from aiohttp.test_utils import make_mocked_coro

from openwebvulndb.common.errors import ExecutionFailure, DirectoryExpected
Expand Down
2 changes: 1 addition & 1 deletion tests/common_test/parallel_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

from unittest import TestCase
from fixtures import async_test
from tests.fixtures import async_test
import async_timeout
from aiohttp.test_utils import make_mocked_coro

Expand Down
2 changes: 1 addition & 1 deletion tests/common_test/release_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from aiohttp import BasicAuth
from aiohttp.test_utils import make_mocked_coro
from fixtures import async_test, ClientSessionMock
from tests.fixtures import async_test, ClientSessionMock

from openwebvulndb.common.release import GitHubRelease

Expand Down
2 changes: 1 addition & 1 deletion tests/common_test/securityfocusfetcher_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import unittest
from unittest.mock import MagicMock
from fixtures import file_path, async_test, ClientSessionMock
from tests.fixtures import file_path, async_test, ClientSessionMock
from aiohttp.test_utils import make_mocked_coro
from openwebvulndb.common.securityfocus.fetcher import SecurityFocusFetcher
import asyncio
Expand Down
2 changes: 1 addition & 1 deletion tests/common_test/securityfocusparsers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from datetime import datetime
from openwebvulndb.common.securityfocus.parsers import InfoTabParser, ReferenceTabParser, \
DiscussionTabParser, ExploitTabParser, SolutionTabParser
from fixtures import file_path
from tests.fixtures import file_path
from lxml import etree


Expand Down
2 changes: 1 addition & 1 deletion tests/common_test/securityfocusreader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import unittest
from unittest.mock import MagicMock
from openwebvulndb.common.securityfocus.parsers import InfoTabParser, ReferenceTabParser
from fixtures import file_path, ClientSessionMock, async_test
from tests.fixtures import file_path, ClientSessionMock, async_test
from openwebvulndb.common.securityfocus.reader import SecurityFocusReader
from openwebvulndb.common.storage import Storage
from openwebvulndb.common.manager import VulnerabilityManager
Expand Down
2 changes: 1 addition & 1 deletion tests/common_test/storage_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from unittest import TestCase
from unittest.mock import mock_open, patch, call, MagicMock, ANY

from fixtures import file_path
from tests.fixtures import file_path

from openwebvulndb.common import Storage, Meta, VulnerabilityList, VersionList
from openwebvulndb.common.schemas import VersionListSchema
Expand Down
2 changes: 1 addition & 1 deletion tests/common_test/vcs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import asyncio
from unittest import TestCase
from unittest.mock import MagicMock, call, patch
from fixtures import async_test, fake_future, file_path, freeze_time
from tests.fixtures import async_test, fake_future, file_path, freeze_time
from datetime import date

from openwebvulndb.common import RepositoryChecker, Repository
Expand Down
2 changes: 1 addition & 1 deletion tests/wordpress_test/api_parse_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from openwebvulndb.wordpress.errors import PluginNotFound, ThemeNotFound
from openwebvulndb.common import Meta, Repository

from fixtures import read_file
from tests.fixtures import read_file


class PluginApiParseTest(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/wordpress_test/enumerate_plugins_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from unittest import TestCase
from unittest.mock import MagicMock, call
from fixtures import read_file, async_test, fake_future, ClientSessionMock, ClientResponse
from tests.fixtures import read_file, async_test, fake_future, ClientSessionMock, ClientResponse
from openwebvulndb.wordpress.repository import WordPressRepository, RepositoryUnreachable
from openwebvulndb.wordpress.errors import PluginNotFound
from openwebvulndb.common import Meta, Repository
Expand Down
2 changes: 1 addition & 1 deletion tests/wordpress_test/enumerate_themes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from unittest import TestCase
from unittest.mock import MagicMock, call
from fixtures import read_file, async_test, fake_future, ClientSessionMock, ClientResponse
from tests.fixtures import read_file, async_test, fake_future, ClientSessionMock, ClientResponse
from openwebvulndb.wordpress.repository import WordPressRepository, RepositoryUnreachable
from openwebvulndb.wordpress.errors import PluginNotFound
from openwebvulndb.common import Meta, Repository
Expand Down
2 changes: 1 addition & 1 deletion tests/wordpress_test/vane_import_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from unittest import TestCase
from unittest.mock import MagicMock, mock_open, patch, call
from fixtures import file_path, freeze_time
from tests.fixtures import file_path, freeze_time
from datetime import datetime, timedelta

from openwebvulndb.common import VulnerabilityManager
Expand Down
2 changes: 1 addition & 1 deletion tests/wordpress_test/vane_version_rebuild_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

from unittest import TestCase
from fixtures import file_path
from tests.fixtures import file_path

from openwebvulndb.common.models import VersionList
from openwebvulndb.wordpress.vane import VaneVersionRebuild
Expand Down

0 comments on commit 0bf39cd

Please sign in to comment.