How to use Python 3.6 interpreter inside a bash script?

Viewed 11560

I want to have a little script, that will find, run and report about all the tests in the folder, like this one:

#!/bin/bash 
coverage run -m unittest discover 
coverage report -m 

But, when I run it, I get some errors, which I do not get on Windows (like using of super() without an argument). As I've understood, it's connected with the fact, that build-in and default version of Python on Linux is 2.x, whereas I am using 3.6. How should I change the script, so it would use Python 3.6 interpreter?

EDIT: So here's one of the files with tests that I run:

#!/usr/bin/env python3
import unittest
import random
import math
import sort_functions as s
from comparison_functions import less, greater


class BaseTestCases:
    class BaseTest(unittest.TestCase):
        sort_func = None

        def setUp(self):
            self.array_one = [101, -12, 99, 3, 2, 1]
            self.array_two = [random.random() for _ in range(100)]
            self.array_three = [random.random() for _ in range(500)]
            self.result_one = sorted(self.array_one)
            self.result_two = sorted(self.array_two)
            self.result_three = sorted(self.array_three)

        def tearDown(self):
            less.calls = 0
            greater.calls = 0

        def test_sort(self):
            result_one = self.sort_func(self.array_one)
            result_two = self.sort_func(self.array_two)
            result_three = self.sort_func(self.array_three)
            self.assertEqual(self.result_one, result_one)
            self.assertEqual(self.result_two, result_two)
            self.assertEqual(self.result_three, result_three)

    # and some more tests here       


class TestBubble(BaseTestCases.BaseTest):
    def setUp(self):
    self.sort_func = s.bubble_sort
    super().setUp()

# and some more classes looking like this

And the error:

ERROR: test_key (test_sort_func.TestBubble)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/lelik/Desktop/Sorters/test_sort_func.py", line 67, in setUp
super().setUp()
TypeError: super() takes at least 1 argument (0 given)
2 Answers
Related