Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
package_control_channel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
package_control_channel
Commits
a0166b87
Commit
a0166b87
authored
Sep 17, 2013
by
FichteFoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the tests to only generate tests for all repositories when passed `--test-repositories`
(Also improve a debug message)
parent
650e94d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
test.py
tests/test.py
+16
-7
No files found.
tests/test.py
View file @
a0166b87
...
@@ -6,14 +6,16 @@ You can run this script directly or with `python -m unittest` from this or the
...
@@ -6,14 +6,16 @@ You can run this script directly or with `python -m unittest` from this or the
root directory. For some reason `nosetests` does not pick up the generated tests
root directory. For some reason `nosetests` does not pick up the generated tests
even though they are generated at load time.
even though they are generated at load time.
However, only running the script directly will generate tests for all
Arguments:
repositories in channel.json. This is to reduce the load time for every test run
--test-repositories
by travis (and reduces unnecessary failures).
Also generates tests for all repositories in `channel.json` (the http
ones).
"""
"""
import
os
import
os
import
re
import
re
import
json
import
json
import
sys
import
unittest
import
unittest
from
collections
import
OrderedDict
from
collections
import
OrderedDict
...
@@ -21,6 +23,13 @@ from functools import wraps
...
@@ -21,6 +23,13 @@ from functools import wraps
from
urllib.request
import
urlopen
from
urllib.request
import
urlopen
from
urllib.error
import
HTTPError
from
urllib.error
import
HTTPError
arglist
=
[
'--test-repositories'
]
# Exctract used arguments form the commandline an strip them for unittest.main
userargs
=
[
arg
for
arg
in
sys
.
argv
if
arg
in
arglist
]
for
arg
in
userargs
:
if
arg
in
sys
.
argv
:
sys
.
argv
.
remove
(
arg
)
################################################################################
################################################################################
# Utilities
# Utilities
...
@@ -164,7 +173,7 @@ class TestContainer(object):
...
@@ -164,7 +173,7 @@ class TestContainer(object):
def
_test_package
(
self
,
include
,
data
):
def
_test_package
(
self
,
include
,
data
):
for
k
,
v
in
data
.
items
():
for
k
,
v
in
data
.
items
():
self
.
assertIn
(
k
,
self
.
package_key_types_map
)
self
.
assertIn
(
k
,
self
.
package_key_types_map
)
self
.
assertIsInstance
(
v
,
self
.
package_key_types_map
[
k
])
self
.
assertIsInstance
(
v
,
self
.
package_key_types_map
[
k
]
,
k
)
if
k
in
(
'details'
,
'homepage'
,
'readme'
,
'issues'
,
'donate'
,
if
k
in
(
'details'
,
'homepage'
,
'readme'
,
'issues'
,
'donate'
,
'buy'
):
'buy'
):
...
@@ -263,9 +272,9 @@ class ChannelTests(TestContainer, unittest.TestCase):
...
@@ -263,9 +272,9 @@ class ChannelTests(TestContainer, unittest.TestCase):
@
classmethod
@
classmethod
def
generate_repository_tests
(
cls
):
def
generate_repository_tests
(
cls
):
if
__name__
!=
'__main__'
:
if
not
"--test-repositories"
in
userargs
:
#
Do not
generate tests for all repositories (those hosted online)
#
Only
generate tests for all repositories (those hosted online)
# when
testing with unittest's crawler; only when run directly
.
# when
run with "--test-repositories" parameter
.
return
return
for
repository
in
cls
.
j
[
'repositories'
]:
for
repository
in
cls
.
j
[
'repositories'
]:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment