Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SickRage-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
SickRage-1
Commits
5b48eeac
Commit
5b48eeac
authored
9 years ago
by
labrys
Browse files
Options
Downloads
Plain Diff
Merge pull request #241 from labrys/lint-issue_submitter_tests
Lint 10/10
parents
766ddcba
87e0e6e2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/issue_submitter_tests.py
+24
-10
24 additions, 10 deletions
tests/issue_submitter_tests.py
with
24 additions
and
10 deletions
tests/issue_submitter_tests.py
+
24
−
10
View file @
5b48eeac
...
@@ -17,29 +17,42 @@
...
@@ -17,29 +17,42 @@
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
"""
Test exception logging
"""
import
sys
,
os
.
path
import
sys
import
os.path
import
unittest
sys
.
path
.
insert
(
1
,
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
../lib
'
)))
sys
.
path
.
insert
(
1
,
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
../lib
'
)))
sys
.
path
.
insert
(
1
,
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
..
'
)))
sys
.
path
.
insert
(
1
,
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
..
'
)))
import
unittest
from
sickbeard
import
logger
from
sickbeard
import
logger
from
sickrage.helper.exceptions
import
ex
from
sickrage.helper.exceptions
import
ex
def
error
():
def
exception_generator
():
"""
Dummy function to raise a fake exception and log it
"""
try
:
try
:
raise
Exception
(
'
FAKE EXCEPTION
'
)
raise
Exception
(
'
FAKE EXCEPTION
'
)
except
Exception
as
e
:
except
Exception
as
e
rror
:
logger
.
log
(
u
"
FAKE ERROR:
"
+
ex
(
e
),
logger
.
ERROR
)
logger
.
log
(
u
"
FAKE ERROR:
"
+
ex
(
e
rror
),
logger
.
ERROR
)
# pylint: disable=no-member
logger
.
submit_errors
()
logger
.
submit_errors
()
# pylint: disable=no-member
raise
raise
class
IssueSubmitterBasicTests
(
unittest
.
TestCase
):
class
IssueSubmitterBasicTests
(
unittest
.
TestCase
):
"""
Tests logging of exceptions
"""
def
test_submitter
(
self
):
def
test_submitter
(
self
):
self
.
assertRaises
(
Exception
,
error
)
"""
Test that an exception is raised
"""
self
.
assertRaises
(
Exception
,
exception_generator
)
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
...
@@ -47,5 +60,6 @@ if __name__ == "__main__":
...
@@ -47,5 +60,6 @@ if __name__ == "__main__":
print
"
STARTING - ISSUE SUBMITTER TESTS
"
print
"
STARTING - ISSUE SUBMITTER TESTS
"
print
"
==================
"
print
"
==================
"
print
"
######################################################################
"
print
"
######################################################################
"
suite
=
unittest
.
TestLoader
().
loadTestsFromTestCase
(
IssueSubmitterBasicTests
)
unittest
.
TextTestRunner
(
verbosity
=
2
).
run
(
suite
)
SUITE
=
unittest
.
TestLoader
().
loadTestsFromTestCase
(
IssueSubmitterBasicTests
)
unittest
.
TextTestRunner
(
verbosity
=
2
).
run
(
SUITE
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment