Are all operators really associative? Operators are associative as seen here.
But when we try to calculate $[\hat{x}, \hat{p}]$ for example, we use a test function and apply $\hat{p}$ to both $\hat{x}$ and the function, instead of associating $\hat{p}$ with $\hat{x}$ and be done with it (obviously the result would be incorrect).
Edit to elaborate my question:
$[\hat{x}, \hat{p}] f =  \hat{x}\hat{p}f - (\hat{p} \hat{x}) f = \hbar/i \bigg(\hat{x} (\partial f/\partial x) - (\partial x/\partial x)f\bigg) = \hbar/i \bigg(\hat{x} \ \partial /\partial x - 1) f\bigg)$
Why can't we do what we did on the second term? Associate the operators before applying them on the test functions?
 A: Suppose we want to evaluate
$$\hat{p} \hat{x} \psi(x).$$
Everything here is perfectly associative, so you can evaluate it two ways,
$$\hat{p} \hat{x} \psi(x) = (\hat{p} \hat{x}) \psi(x) = \hat{p} (\hat{x} \psi(x)).$$
The error you made is that you can't compute $\hat{p} \hat{x}$ like this:
$$\hat{p} \hat{x} = - i\frac{\partial}{\partial x} \hat{x} \neq - i\frac{\partial}{\partial x} x = - i.$$
The issue is that $\hat{x}$ isn't the same thing as $x$. The operator $\hat{x}$ acts on wavefunctions $\psi(x)$ by multiplying them by $x$, but that isn't the same thing as saying it is the number $x$. The operator $\hat{p} \hat{x}$ needs to be thought of as doing these two operations in order: multiply wavefunctions by $x$, then apply $- i \partial / \partial x$. 
A: Operators act on elements of the Hilbert space, not other operators.  $\hat p$ and $\hat x$ are defined by how they act on states, e.g.
$$\hat p: f(x) \mapsto -if'(x)$$
$$\hat x: f(x) \mapsto x\cdot f(x)$$
There is no sense in which $\hat p$ can act on $\hat x$, or vice versa.  We can, however, compose operators (also called multiplying them, by overloading the term "multiply") by applying them one after another:
$$(\hat p \circ \hat x): f(x) \mapsto \hat p\big(\hat x(f(x))\big) = \hat p\big(x f(x)\big) = -i\big[x f(x)\big]'$$
$$(\hat x \circ \hat p): f(x) \mapsto \hat x\big(\hat p(f(x))\big) = \hat x\big(-if'(x)\big) = -ixf'(x)$$
where $\hat p \circ \hat x$ is pronounced "$\hat p$ after $\hat x$".  It is conventional to drop the $\circ$ notation, but this is what appears in the commutation relations.
A: Operators, in general, are associative. Associative means that we can calculate in a different order
$$ABC = (AB)C = A(BC)$$
but it does not mean that we can write the operators in a different order. You are confusing it with commutative. We do not, in general have
$$AB = BA$$
Consider a simple example. If you reflect an image in the $y$-axis (operator $B$), and then rotate the result by $90^\circ$ (operator $A$) then you will get a different result from rotating the image and then reflecting. In matrices this is 
$$AB = 
\begin{pmatrix}
0 & -1 \\
1 & 0 \\
\end{pmatrix}
\begin{pmatrix}
-1& 0 \\
0 &1 \\
\end{pmatrix}
\neq
\begin{pmatrix}
-1& 0 \\
0 &1 \\
\end{pmatrix}
\begin{pmatrix}
0 & -1 \\
1 & 0 \\
\end{pmatrix}
=BA
$$
as you can easily check.
A: No, operators are not all associative. Though in regards to your example, linear operators acting on a separable Hilbert space are. It would be interesting if any new formulation of quantum mechanics can make use of non-associative operators. Some people wrote more ideas about that and other physical applications in the following post.
Non-associative operators in Physics
One of the answers mentioned some work done using deformation quantization as a possible way to work towards that idea (eventually). I wanted to at least mention it since that method is highly related to (a particular) functional calculus, which seems more closely related to the spirit of your question and comes up in commutator computations often.
