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
02c8ede3
Commit
02c8ede3
authored
Aug 05, 2013
by
FichteFoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the tests runnable without relying on the root directory
Also do not "leak" file handles.
parent
da5e7328
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
test.py
tests/test.py
+21
-2
No files found.
tests/test.py
View file @
02c8ede3
#!/usr/bin/env python
"""Tests for the validity of the channel file
You can run this file directly or with `notetests` (or `python -m unittest`)
from the root directory.
"""
import
os
import
json
import
unittest
from
collections
import
OrderedDict
# Only run these using `notetests` (or `python -m unittest`) from the root directory
repo_file
=
"repositories.json"
# No need to check for this because all the other tests would fail anyway
...
...
@@ -17,7 +27,8 @@ class TestOrder(unittest.TestCase):
maxDiff
=
None
def
setUp
(
self
):
self
.
j
=
json
.
load
(
open
(
"repositories.json"
),
object_pairs_hook
=
OrderedDict
)
with
open
(
repo_file
)
as
f
:
self
.
j
=
json
.
load
(
f
,
object_pairs_hook
=
OrderedDict
)
def
test_repositories_in_order
(
self
):
repos
=
self
.
j
[
'repositories'
]
...
...
@@ -32,3 +43,11 @@ class TestOrder(unittest.TestCase):
def
test_renamed_packages_in_order
(
self
):
ren_packages
=
list
(
self
.
j
[
'renamed_packages'
]
.
keys
())
self
.
assertEqual
(
ren_packages
,
sorted
(
ren_packages
,
key
=
str
.
lower
))
if
__name__
==
'__main__'
:
# Manually go up one directory if this file is run explicitly
if
not
os
.
path
.
exists
(
repo_file
):
repo_file
=
os
.
path
.
join
(
".."
,
repo_file
)
unittest
.
main
()
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