Skip to content

Commit 4188780

Browse files
committed
Fixing issues on Appveyor tests
* Need to close files before re using and closing tempfile.NamedTemporaryFile also deletes it by default * Removed some unnecessary UI message checks * Excluded branches with 'win', 'windows' or 'Appveyor' from Travis builds
1 parent 753d6fa commit 4188780

File tree

3 files changed

+8
-40
lines changed

3 files changed

+8
-40
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ stages:
2121
- test
2222
- deploy
2323

24+
branches:
25+
except:
26+
- /.*?\b((?i:windows)|(?i:win)|(?i:appveyor))\b.*/
27+
2428
jobs:
2529
include:
2630
- name: Python 2.7

hdl_checker/tests/test_base_server.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,6 @@ def _makeConfigFromDict(dict_):
122122

123123
it.assertSameFile = assertSameFile(it)
124124

125-
def _assertMsgQueueIsEmpty(project):
126-
msg = []
127-
while not project._msg_queue.empty():
128-
msg += [str(project._msg_queue.get())]
129-
130-
if msg:
131-
msg.insert(
132-
0, "Message queue should be empty but has %d messages" % len(msg)
133-
)
134-
it.fail("\n".join(msg))
135-
136-
it.assertMsgQueueIsEmpty = _assertMsgQueueIsEmpty
137-
138125
@it.should("warn when setup is taking too long")
139126
@patch("hdl_checker.base_server._HOW_LONG_IS_TOO_LONG", 0.1)
140127
@patch.object(
@@ -578,8 +565,6 @@ def test():
578565
diagnostics,
579566
)
580567

581-
it.assertMsgQueueIsEmpty(it.project)
582-
583568
it.assertTrue(it.project.database.paths)
584569

585570
@it.should("get messages for relative path") # type: ignore
@@ -591,8 +576,6 @@ def test():
591576

592577
it.assertFalse(p.isabs(filename))
593578

594-
it.assertMsgQueueIsEmpty(it.project)
595-
596579
diagnostics = it.project.getMessagesByPath(Path(filename))
597580

598581
it.assertIn(
@@ -606,8 +589,6 @@ def test():
606589
diagnostics,
607590
)
608591

609-
it.assertMsgQueueIsEmpty(it.project)
610-
611592
@it.should("get messages with text") # type: ignore
612593
def test():
613594
it.assertTrue(it.project.database.paths)
@@ -625,8 +606,6 @@ def test():
625606
for lnum, line in enumerate(content.split("\n")):
626607
_logger.debug("%2d| %s", (lnum + 1), line)
627608

628-
it.assertMsgQueueIsEmpty(it.project)
629-
630609
diagnostics = set(it.project.getMessagesWithText(filename, content))
631610

632611
logIterable("Diagnostics", diagnostics, _logger.info)
@@ -651,7 +630,6 @@ def test():
651630
]
652631

653632
it.assertCountEqual(diagnostics, expected)
654-
it.assertMsgQueueIsEmpty(it.project)
655633

656634
@it.should( # type: ignore
657635
"get messages with text for file outside the project file"
@@ -664,8 +642,6 @@ def test():
664642
["library work;", "use work.all;", "entity some_entity is end;"]
665643
)
666644

667-
it.assertMsgQueueIsEmpty(it.project)
668-
669645
diagnostics = it.project.getMessagesWithText(filename, content)
670646

671647
_logger.debug("Records received:")
@@ -688,14 +664,10 @@ def test():
688664

689665
raise
690666

691-
it.assertMsgQueueIsEmpty(it.project)
692-
693667
@it.should("get updated messages") # type: ignore
694668
def test():
695669
filename = Path(p.join(TEST_PROJECT, "another_library", "foo.vhd"))
696670

697-
it.assertMsgQueueIsEmpty(it.project)
698-
699671
code = open(str(filename), "r").read().split("\n")
700672

701673
code[28] = "-- " + code[28]
@@ -719,14 +691,10 @@ def test():
719691
code[28] = code[28][3:]
720692
writeListToFile(str(filename), code)
721693

722-
it.assertMsgQueueIsEmpty(it.project)
723-
724694
@it.should("get messages by path of a different source") # type: ignore
725695
def test():
726696
filename = Path(p.join(TEST_PROJECT, "basic_library", "clock_divider.vhd"))
727697

728-
it.assertMsgQueueIsEmpty(it.project)
729-
730698
it.assertCountEqual(
731699
it.project.getMessagesByPath(filename),
732700
[
@@ -740,17 +708,13 @@ def test():
740708
],
741709
)
742710

743-
it.assertMsgQueueIsEmpty(it.project)
744-
745711
@it.should( # type: ignore
746712
"get messages from a source outside the project file"
747713
)
748714
def test():
749715
filename = Path(p.join(TEST_TEMP_PATH, "some_file.vhd"))
750716
writeListToFile(str(filename), ["library some_lib;"])
751717

752-
it.assertMsgQueueIsEmpty(it.project)
753-
754718
diagnostics = it.project.getMessagesByPath(filename)
755719

756720
_logger.info("Records found:")
@@ -766,8 +730,6 @@ def test():
766730
"message here indicating an error",
767731
)
768732

769-
it.assertMsgQueueIsEmpty(it.project)
770-
771733
def basicRebuildTest(test_filename, rebuilds):
772734
calls = []
773735
ret_list = list(reversed(rebuilds))

hdl_checker/tests/test_database.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,9 @@ def test_AcceptsEmptySourcesList(self, meth):
175175
# type: (...) -> Any
176176
# Make TEST_TEMP_PATH/some_path.vhd readable so it is returned by
177177
# findRtlSourcesByPath
178-
with tempfile.NamedTemporaryFile(suffix=".vhd") as path:
178+
with tempfile.NamedTemporaryFile(suffix=".vhd", delete=False) as path:
179179
meth.return_value = [Path(path.name)]
180+
path.close()
180181

181182
self.database.configure(dict(), TEST_TEMP_PATH)
182183

@@ -196,8 +197,9 @@ def test_AcceptsEmptyDict(self, meth):
196197
# type: (...) -> Any
197198
# Make TEST_TEMP_PATH/some_path.vhd readable so it is returned by
198199
# findRtlSourcesByPath
199-
with tempfile.NamedTemporaryFile(suffix=".vhd") as path:
200+
with tempfile.NamedTemporaryFile(suffix=".vhd", delete=False) as path:
200201
meth.return_value = [Path(path.name)]
202+
path.close()
201203

202204
self.database.configure({}, TEST_TEMP_PATH)
203205

0 commit comments

Comments
 (0)