The reason you're getting random composites is because you aren't exiting your for loop after coming across a number in "primesrange" that divides your "test" number evenly. Instead you are incrementing the "test" number by 2 and then continuing the divisibility checking where the previous number left off.
So, what happens in the case of the number 95 is as follows:
Your program correctly determines that 89 is prime.
It then starts checking 91 for divisibility by 2, 3, 4, ... until it gets to 7.
91 is evenly divisible by 7 so your "test" number gets incremented to 93 and divisibility checking continues. However, instead of starting back at 2, your program will start at 8, 9, ..., and continue until 31. When you start checking 95, there are no numbers in the range 32, ..., 94 that divide it evenly, so your program decides that it is prime.
The easiest way to fix this problem would be to add a break statement on the line after "test = test + 2"