import os
import mylib
os.system('make all')


def test_squared():
    assert 16. == mylib.squared(4) 


def test_myfunction():
    assert 16. == mylib.myfunction(mylib.squared, 4) 


os.system('make clean')

@@ -7,21 +7,252 @@
  os%0A
+%0A
 import 
-mylib%0A
+pytest%0A%0A@pytest.fixture%0Adef setup(request):%0A    def teardown():%0A        print(%22Running make clean%22)%0A        os.system('make clean')%0A        print(%22Completed finaliser%22)%0A    request.addfinalizer(teardown)%0A    os.system('make clean')%0A    
 os.s
@@ -288,19 +288,41 @@
 squared(
+setup
 ):%0A
+    import mylib%0A
     asse
@@ -371,18 +371,40 @@
 unction(
-):
+setup):%0A    import mylib
 %0A    ass
@@ -455,29 +455,4 @@
 ) %0A%0A
-%0Aos.system('make clean')%0A

Use pytest fixture to deal with compilation