diff --git a/.gitignore b/.gitignore index e2b0005..13b7e30 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,4 @@ env test/unit/test_devices.py +report.json diff --git a/.travis.yml b/.travis.yml index 5c99348..f96538c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,9 @@ language: python - python: -- 2.7 - + - 2.7 install: -- pip install -r requirements-dev.txt -- pip install . - -script: -- py.test -- pylama . - -after_success: - - coveralls - - if [ $TRAVIS_TAG ]; then curl -X POST https://readthedocs.org/build/napalm; fi - + - pip install tox-travis + - pip install coveralls deploy: provider: pypi user: dbarroso @@ -23,3 +12,8 @@ deploy: on: tags: true branch: master +script: + - tox +after_success: + - coveralls + - if [ $TRAVIS_TAG ]; then curl -X POST https://readthedocs.org/build/napalm; fi diff --git a/napalm_fortios/fortios.py b/napalm_fortios/fortios.py index 46d5efe..a9cddcc 100644 --- a/napalm_fortios/fortios.py +++ b/napalm_fortios/fortios.py @@ -47,7 +47,7 @@ def is_alive(self): 'is_alive': self.device.ssh.get_transport().is_active() } - def execute_command_with_vdom(self, command, vdom=None): + def _execute_command_with_vdom(self, command, vdom=None): # If the user doesn't specify a particular vdom we use the default vdom for the object. vdom = vdom or self.vdom @@ -70,8 +70,8 @@ def execute_command_with_vdom(self, command, vdom=None): # If there is no vdom we just execute the command return self.device.execute_command(command) - def get_command_with_vdom(self, cmd, separator=':', auto=False, vdom=None): - output = self.execute_command_with_vdom(cmd, vdom) + def _get_command_with_vdom(self, cmd, separator=':', auto=False, vdom=None): + output = self._execute_command_with_vdom(cmd, vdom) if auto: if ':' in output[0]: @@ -121,7 +121,7 @@ def compare_config(self): def commit_config(self): try: - self.execute_command_with_vdom('execute backup config flash commit_with_napalm') + self._execute_command_with_vdom('execute backup config flash commit_with_napalm') self.device.commit() self.discard_config() except FailedCommit as e: @@ -135,9 +135,9 @@ def discard_config(self): self.device.load_config(in_candidate=True) def rollback(self): - output = self.execute_command_with_vdom('fnsysctl ls -l data2/config', vdom=None) + output = self._execute_command_with_vdom('fnsysctl ls -l data2/config', vdom=None) rollback_file = output[-2].split()[-1] - rollback_config = self.execute_command_with_vdom( + rollback_config = self._execute_command_with_vdom( 'fnsysctl cat data2/config/{rollback_file}'.format(rollback_file)) self.device.load_config(empty_candidate=True) @@ -159,7 +159,7 @@ def get_config(self, retrieve="all"): get_candidate = retrieve == "all" or retrieve == "candidate" if retrieve == "all" or get_running: - result = self.execute_command_with_vdom('show') + result = self._execute_command_with_vdom('show') text_result = '\n'.join(result) return { @@ -176,14 +176,16 @@ def get_config(self, retrieve="all"): } def get_facts(self): - system_status = self.get_command_with_vdom('get system status', vdom='global') - performance_status = self.get_command_with_vdom('get system performance status', - vdom='global') + system_status = self._get_command_with_vdom('get system status', vdom='global') + performance_status = self._get_command_with_vdom('get system performance status', + vdom='global') - interfaces = self.execute_command_with_vdom('get system interface | grep ==', vdom='global') + interfaces = self._execute_command_with_vdom('get system interface | grep ==', + vdom='global') interface_list = [x.split()[2] for x in interfaces if x.strip() is not ''] - domain = self.get_command_with_vdom('get system dns | grep domain', vdom='global')['domain'] + domain = self._get_command_with_vdom('get system dns | grep domain', + vdom='global')['domain'] return { 'vendor': unicode('Fortigate'), @@ -218,12 +220,13 @@ def _get_unsupported_interfaces(): } def get_interfaces(self): - cmd_data = self.execute_command_with_vdom('diagnose hardware deviceinfo nic', vdom='global') + cmd_data = self._execute_command_with_vdom('diagnose hardware deviceinfo nic', + vdom='global') interface_list = [x.replace('\t', '') for x in cmd_data if x.startswith('\t')] interface_statistics = {} for interface in interface_list: - if_data = self.execute_command_with_vdom( + if_data = self._execute_command_with_vdom( 'diagnose hardware deviceinfo nic {}'.format(interface), vdom='global') parsed_data = {} if interface.startswith('mgmt'): @@ -262,7 +265,7 @@ def _search_line_in_lines(search, lines): return l def get_firewall_policies(self): - cmd = self.execute_command_with_vdom('show firewall policy') + cmd = self._execute_command_with_vdom('show firewall policy') policy = dict() policy_id = None default_policy = dict() @@ -315,7 +318,7 @@ def get_bgp_neighbors(self): command_received = 'get router info bgp neighbors {} received-routes | grep prefixes ' peers = dict() - bgp_sum = self.execute_command_with_vdom(command_sum) + bgp_sum = self._execute_command_with_vdom(command_sum) re_neigh = re.compile("^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") neighbors = {n.split()[0]: n.split()[1:] for n in bgp_sum if re.match(re_neigh, n)} @@ -340,7 +343,7 @@ def get_bgp_neighbors(self): neighbor_dict['address_family']['ipv6'] = dict() detail_output = [x.lower() for x in - self.execute_command_with_vdom(command_detail.format(neighbor))] + self._execute_command_with_vdom(command_detail.format(neighbor))] m = re.search('remote router id (.+?)\n', '\n'.join(detail_output)) if m: neighbor_dict['remote_id'] = unicode(m.group(1)) @@ -357,7 +360,7 @@ def get_bgp_neighbors(self): t = [int(s) for s in text.split() if s.isdigit()][0] neighbor_dict['address_family'][family][term] = t - received = self.execute_command_with_vdom( + received = self._execute_command_with_vdom( command_received.format(neighbor))[0].split() if len(received) > 0: neighbor_dict['address_family'][family]['received_prefixes'] = received[-1] @@ -374,7 +377,7 @@ def get_bgp_neighbors(self): } def get_interfaces_counters(self): - cmd = self.execute_command_with_vdom('fnsysctl ifconfig', vdom=None) + cmd = self._execute_command_with_vdom('fnsysctl ifconfig', vdom=None) if_name = None interface_counters = dict() for line in cmd: @@ -471,7 +474,7 @@ def get_temperature(temperature_lines, detail_block): out = dict() sensors_block = [parse_string(x) for x in - self.execute_command_with_vdom('execute sensor detail', vdom='global') + self._execute_command_with_vdom('execute sensor detail', vdom='global') if x] # temp @@ -485,14 +488,14 @@ def get_temperature(temperature_lines, detail_block): # cpu out['cpu'] = get_cpu( [x for x in - self.execute_command_with_vdom('get system performance status | grep CPU', - vdom='global')[1:] if x]) + self._execute_command_with_vdom('get system performance status | grep CPU', + vdom='global')[1:] if x]) # memory memory_command = 'diag hard sys mem | grep Mem:' t = [x for x in - re.split('\s+', self.execute_command_with_vdom(memory_command, - vdom='global')[0]) if x] + re.split('\s+', self._execute_command_with_vdom(memory_command, + vdom='global')[0]) if x] out['memory'] = get_memory(t) # power, not implemented diff --git a/report.json b/report.json deleted file mode 100644 index f372b0e..0000000 --- a/report.json +++ /dev/null @@ -1 +0,0 @@ -{"included": [{"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_bgp_neighbors[normal]", "teardown": {"duration": 7.700920104980469e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003800392150878906, "outcome": "passed", "name": "setup"}, "run_index": 11, "call": {"duration": 0.004490852355957031, "outcome": "passed", "name": "call"}, "duration": 0.005327939987182617, "outcome": "passed"}, "type": "test", "id": 1}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_route_to[no_test_case_found]", "teardown": {"duration": 6.389617919921875e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003459453582763672, "outcome": "passed", "name": "setup"}, "run_index": 13, "call": {"duration": 0.00012302398681640625, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0008788108825683594, "outcome": "skipped"}, "type": "test", "id": 2}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_arp_table[no_test_case_found]", "teardown": {"duration": 6.914138793945312e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.000370025634765625, "outcome": "passed", "name": "setup"}, "run_index": 1, "call": {"duration": 0.00012612342834472656, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0009353160858154297, "outcome": "skipped"}, "type": "test", "id": 3}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_network_instances[no_test_case_found]", "teardown": {"duration": 7.104873657226562e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0004589557647705078, "outcome": "passed", "name": "setup"}, "run_index": 8, "call": {"duration": 0.000125885009765625, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0011148452758789062, "outcome": "skipped"}, "type": "test", "id": 4}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_probes_config[no_test_case_found]", "teardown": {"duration": 7.009506225585938e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003409385681152344, "outcome": "passed", "name": "setup"}, "run_index": 3, "call": {"duration": 0.00026488304138183594, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.001016855239868164, "outcome": "skipped"}, "type": "test", "id": 5}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_ntp_servers[no_test_case_found]", "teardown": {"duration": 0.00011706352233886719, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.007989168167114258, "outcome": "passed", "name": "setup"}, "run_index": 0, "call": {"duration": 0.00020694732666015625, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.01630234718322754, "outcome": "skipped"}, "type": "test", "id": 6}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_users[no_test_case_found]", "teardown": {"duration": 6.29425048828125e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00034308433532714844, "outcome": "passed", "name": "setup"}, "run_index": 18, "call": {"duration": 0.00011801719665527344, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0008671283721923828, "outcome": "skipped"}, "type": "test", "id": 7}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_interfaces_counters[normal]", "teardown": {"duration": 7.891654968261719e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003077983856201172, "outcome": "passed", "name": "setup"}, "run_index": 10, "call": {"duration": 0.007678031921386719, "outcome": "passed", "name": "call"}, "duration": 0.00837254524230957, "outcome": "passed"}, "type": "test", "id": 8}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_config[normal]", "teardown": {"duration": 6.29425048828125e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00037789344787597656, "outcome": "passed", "name": "setup"}, "run_index": 25, "call": {"duration": 0.0005838871002197266, "outcome": "passed", "name": "call"}, "duration": 0.0014026165008544922, "outcome": "passed"}, "type": "test", "id": 9}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_is_alive[no_test_case_found]", "teardown": {"duration": 6.29425048828125e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00033211708068847656, "outcome": "passed", "name": "setup"}, "run_index": 19, "call": {"duration": 0.00011897087097167969, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0008461475372314453, "outcome": "skipped"}, "type": "test", "id": 10}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_probes_results[no_test_case_found]", "teardown": {"duration": 8.487701416015625e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003800392150878906, "outcome": "passed", "name": "setup"}, "run_index": 21, "call": {"duration": 0.00023889541625976562, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0010838508605957031, "outcome": "skipped"}, "type": "test", "id": 11}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_mac_address_table[no_test_case_found]", "teardown": {"duration": 6.604194641113281e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003840923309326172, "outcome": "passed", "name": "setup"}, "run_index": 12, "call": {"duration": 0.00012803077697753906, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0009622573852539062, "outcome": "skipped"}, "type": "test", "id": 12}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_ping[no_test_case_found]", "teardown": {"duration": 7.700920104980469e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0004589557647705078, "outcome": "passed", "name": "setup"}, "run_index": 23, "call": {"duration": 0.0001399517059326172, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0011348724365234375, "outcome": "skipped"}, "type": "test", "id": 13}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_lldp_neighbors_detail[no_test_case_found]", "teardown": {"duration": 6.508827209472656e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003249645233154297, "outcome": "passed", "name": "setup"}, "run_index": 4, "call": {"duration": 0.00012993812561035156, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0008449554443359375, "outcome": "skipped"}, "type": "test", "id": 14}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_environment[normal]", "teardown": {"duration": 8.0108642578125e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003638267517089844, "outcome": "passed", "name": "setup"}, "run_index": 24, "call": {"duration": 0.00433802604675293, "outcome": "passed", "name": "call"}, "duration": 0.0051457881927490234, "outcome": "passed"}, "type": "test", "id": 15}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_bgp_config[no_test_case_found]", "teardown": {"duration": 6.699562072753906e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00036406517028808594, "outcome": "passed", "name": "setup"}, "run_index": 16, "call": {"duration": 0.0001239776611328125, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0009191036224365234, "outcome": "skipped"}, "type": "test", "id": 16}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_config_filtered[normal]", "teardown": {"duration": 8.392333984375e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003631114959716797, "outcome": "passed", "name": "setup"}, "run_index": 22, "call": {"duration": 0.0003178119659423828, "outcome": "passed", "name": "call"}, "duration": 0.0011279582977294922, "outcome": "passed"}, "type": "test", "id": 17}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_ntp_peers[no_test_case_found]", "teardown": {"duration": 6.4849853515625e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003151893615722656, "outcome": "passed", "name": "setup"}, "run_index": 5, "call": {"duration": 0.00012111663818359375, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.00081634521484375, "outcome": "skipped"}, "type": "test", "id": 18}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_traceroute[no_test_case_found]", "teardown": {"duration": 6.604194641113281e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00033593177795410156, "outcome": "passed", "name": "setup"}, "run_index": 20, "call": {"duration": 0.00011491775512695312, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0008528232574462891, "outcome": "skipped"}, "type": "test", "id": 19}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_interfaces[normal]", "teardown": {"duration": 6.604194641113281e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00034809112548828125, "outcome": "passed", "name": "setup"}, "run_index": 2, "call": {"duration": 0.0009751319885253906, "outcome": "passed", "name": "call"}, "duration": 0.001737356185913086, "outcome": "passed"}, "type": "test", "id": 20}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_optics[no_test_case_found]", "teardown": {"duration": 6.4849853515625e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003120899200439453, "outcome": "passed", "name": "setup"}, "run_index": 9, "call": {"duration": 0.000125885009765625, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0008149147033691406, "outcome": "skipped"}, "type": "test", "id": 21}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_interfaces_ip[no_test_case_found]", "teardown": {"duration": 6.413459777832031e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003459453582763672, "outcome": "passed", "name": "setup"}, "run_index": 17, "call": {"duration": 0.00013113021850585938, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0008871555328369141, "outcome": "skipped"}, "type": "test", "id": 22}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_ntp_stats[no_test_case_found]", "teardown": {"duration": 6.794929504394531e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00041604042053222656, "outcome": "passed", "name": "setup"}, "run_index": 7, "call": {"duration": 0.0003948211669921875, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.001294851303100586, "outcome": "skipped"}, "type": "test", "id": 23}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_bgp_neighbors_detail[no_test_case_found]", "teardown": {"duration": 6.29425048828125e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00033593177795410156, "outcome": "passed", "name": "setup"}, "run_index": 15, "call": {"duration": 0.0001270771026611328, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0008618831634521484, "outcome": "skipped"}, "type": "test", "id": 24}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_lldp_neighbors[no_test_case_found]", "teardown": {"duration": 0.00010085105895996094, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003330707550048828, "outcome": "passed", "name": "setup"}, "run_index": 6, "call": {"duration": 0.00015687942504882812, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0009238719940185547, "outcome": "skipped"}, "type": "test", "id": 25}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_snmp_information[no_test_case_found]", "teardown": {"duration": 0.0005891323089599609, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.000331878662109375, "outcome": "passed", "name": "setup"}, "run_index": 26, "call": {"duration": 0.0010008811950683594, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0022537708282470703, "outcome": "skipped"}, "type": "test", "id": 26}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_facts[normal]", "teardown": {"duration": 6.389617919921875e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003380775451660156, "outcome": "passed", "name": "setup"}, "run_index": 14, "call": {"duration": 0.0005338191986083984, "outcome": "passed", "name": "call"}, "duration": 0.0012738704681396484, "outcome": "passed"}, "type": "test", "id": 27}], "data": [{"relationships": {"tests": {"data": [{"type": "test", "id": 1}, {"type": "test", "id": 2}, {"type": "test", "id": 3}, {"type": "test", "id": 4}, {"type": "test", "id": 5}, {"type": "test", "id": 6}, {"type": "test", "id": 7}, {"type": "test", "id": 8}, {"type": "test", "id": 9}, {"type": "test", "id": 10}, {"type": "test", "id": 11}, {"type": "test", "id": 12}, {"type": "test", "id": 13}, {"type": "test", "id": 14}, {"type": "test", "id": 15}, {"type": "test", "id": 16}, {"type": "test", "id": 17}, {"type": "test", "id": 18}, {"type": "test", "id": 19}, {"type": "test", "id": 20}, {"type": "test", "id": 21}, {"type": "test", "id": 22}, {"type": "test", "id": 23}, {"type": "test", "id": 24}, {"type": "test", "id": 25}, {"type": "test", "id": 26}, {"type": "test", "id": 27}]}}, "attributes": {"environment": {"Python": "2.7.12", "Platform": "Darwin-16.1.0-x86_64-i386-64bit"}, "created_at": "2016-11-27 14:58:56.238830", "summary": {"duration": 0.33277392387390137, "skipped": 20, "passed": 7, "num_tests": 27}}, "type": "report", "id": 1}]} \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index 0f1c9d3..28df03e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,4 @@ +coveralls pytest pytest-cov pytest-json diff --git a/setup.cfg b/setup.cfg index c338e58..564f110 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,15 +1,15 @@ [pylama] linters = mccabe,pep8,pyflakes ignore = D203,C901 +skip = build/*,.tox/* [pylama:pep8] max_line_length = 100 -[tool:pytest] -addopts = --cov=./ -vs +[pytest] +addopts = --cov=napalm_fortios --cov-report term-missing -vs --pylama json_report = report.json jsonapi = true [coverage:run] -include = - napalm_fortios/* +source = napalm_fortios diff --git a/setup.py b/setup.py index 2537ad6..934edc1 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name="napalm-fortios", - version="0.3.0", + version="0.3.1", packages=find_packages(), author="David Barroso", author_email="dbarrosop@dravetech.com", diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..910c4f4 --- /dev/null +++ b/tox.ini @@ -0,0 +1,9 @@ +[tox] +envlist = py27 + +[testenv] +deps = + -rrequirements-dev.txt + +commands= + py.test